how to return false on empty array in javascript code example
Example 1: javascript is array empty
var colors=[];
if(!colors.length){
// I am empty
}else{
// I am not empty
}
Example 2: empty array javascript
// set array
arr = [1,2,4];
// empty array
arr = [];