js how to check is array empty es6
snippet in javascript

javascript check if array is empty

user8364

if (array && !array.length) {
    // array is defined but has no element
}

js how to check is array empty es6

user6126

var colors=[];
if(!colors.length){
	// I am empty
}else{
	// I am not empty
}