javascript make empty array code example
Example 1: javascript empty array
var colors = ["red","blue","green"];
colors = []; //empty the array
Example 2: create an empty array js
let arrayName = [];
Example 3: how to make array empty
A.length = 0
Example 4: empty array js
let list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
Example 5: javascript empty array
if (array === undefined || array.length == 0) {
// array empty or does not exist
}