array with empty string js code example
Example 1: javascript not empty array not string
if (Array.isArray(array) && array.length) {
// array exists and is not empty
}
Example 2: javascript empty array
var colors = ["red","blue","green"];
colors = []; //empty the array
Example 3: empty array javascript
let myArray = [12 , 222 , 1000 ];
myArray.length = 0; // myArray will be equal to [].