Check If Array Or Not Javascript For Loop