JavaScript: Check if array is empty in javascript