javascript check if array is null or undefined