Basic Algorithm Scripting - Falsy Bouncer

I’ve seen the answers and understand what to do. I am just curious why I wasn’t able to remove NaN from the new array(newArr) but I was able to remove all other falsy values. Thanks!

function bouncer(arr) {
  let newArr = arr.slice();
  let naughtyList = [false, null, 0, "", undefined, NaN];
  for (let i = 0; i < newArr.length; i++) {
    for (let j = 0; j < naughtyList.length; j++) {
      if (newArr[i] == naughtyList[j]) {
        newArr.splice(i, 1);
      }
      console.log(newArr);
    }
  }
  return newArr;
}

bouncer([null, NaN, 1, 2, undefined]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Challenge: Basic Algorithm Scripting - Falsy Bouncer

Link to the challenge:

console.log(NaN === NaN);

what do you see if you run this line of code?

Ahhhhhh thanks for letting me work it out for myself!

I found this while researching why console.log(Nan === Nan); returns false.

The IEEE 754 spec for floating-point numbers (which is used by all languages for floating-point) says that NaNs are never equal.