Javascript Check If Array Is Not Empty Javascript Function Definition