1 empty item javascript array code example
Example 1: javascript check if array is not empty
if (array === undefined || array.length == 0) {
// array empty or does not exist
}
Example 2: remove empty values from array javascript
var array = [0, 1, null, 2, "", 3, undefined, 3,,,,,, 4,, 4,, 5,, 6,,,,];
var filtered = array.filter(function (el) {
return el != null;
});
console.log(filtered);