javascript check if array is not null and not empty