javascript make array empty 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: javascript empty array
var colors = ["red","blue","green"];
colors = []; //empty the array
Example 3: javascript empty array
if (array === undefined || array.length == 0) {
// array empty or does not exist
}