How to check NaN as a falsy value in an Array

Hi together,
in my opinion I am almost there. But I cant solve to “delete” the NaN.
I know NaN is never equal to its self. But I cant solve it with isNaN() too.

I always get wether this result without isNaN()

[ 7, ‘ate’, 9 ]
[ NaN ]
[ NaN, 1, 2 ]

Or this result with isNanN()

[ ‘ate’ ]
[ NaN ]
[ NaN ]

Where is my mistake?
My code:

function bouncer(arr) {
let cleaned = ;
arr.forEach(el => {
if(el !== false && el !== null && el !== 0 && el !== “” && el !== undefined && el !== NaN /Alternatively: isNaN(el)/) {
cleaned.push(el);
}
});

return cleaned;
}

bouncer([7, “ate”, “”, false, 9]);
bouncer([false, null, 0, NaN, undefined, “”]);
bouncer([null, NaN, 1, 2, undefined]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0.

Challenge: Falsy Bouncer

Link to the challenge:

you can avoid comparing each value and just using their falsynesd and truthyness

if (false) {
   // not executed
} else if (true) {
  // this executes
}

you can use falsy and truthy values to get the same

if (/* any falsy value */) {
  // not executed
} else if (/* any truthy value */) {
  // executed
}
1 Like

:man_facepalming:
Of course… I am so stupid…
Thx