javascript array remove falsy values code example
Example: remove falsy values from array javascript
let mixedArr = [0, “blue”, “”, NaN, 9, true, undefined, “white”, false];
let trueArr = mixedArr.filter(Boolean);
console.log(trueArr); // returns [“blue”, 9, true, “white”]