check if array is null or empty javascript code example
Example 1: javascript is array empty
var colors=[];
if(!colors.length){
// I am empty
}else{
// I am not empty
}
Example 2: check if array is empty javascript
array.length = []
var colors=[];
if(!colors.length){
// I am empty
}else{
// I am not empty
}
array.length = []