how to Check if an array is empty or null in Javascript