1let mixedArr = [0, “blue”, “”, NaN, 9, true, undefined, “white”, false];
2let trueArr = mixedArr.filter(Boolean);
3console.log(trueArr); // returns [“blue”, 9, true, “white”]
4
1function bouncer(arr) {
2 arr = arr.filter(function (n) {
3 return (n !== undefined && n !== null && n !== false && n !== 0 && n !== "" && isNaN()!=NaN); });
4 return arr;
5}
6
7bouncer([7, "ate", "", false, 9, NaN], "");
8