Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Check If An Array Is Empty Or Null Or Undefined In JavaScript?

let myArray = [];

if( myArray.length  > 0  ) {
    console.log(myArray);
    console.log("Array has elements");
}
else {
    console.log("Array has no elements");
}
Source by www.tutsplanet.com #
 
PREVIOUS NEXT
Tagged: #Check #If #An #Array #Is #Empty #Or #Null #Or #Undefined #In
ADD COMMENT
Topic
Name
5+5 =