condition for empty array code example
Example 1: javascript is array empty
var colors=[];
if(!colors.length){
// I am empty
}else{
// I am not empty
}
Example 2: how to make array empty
A.length = 0
var colors=[];
if(!colors.length){
// I am empty
}else{
// I am not empty
}
A.length = 0