javascript empty array has length 1