empty array check in javascript code example
Example 1: js how to check is array empty es6
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 = []