Condition To Check Empty Array In Javascript Code