Condition For Empty Array In Javascript