Strange Behaviour With NaN

Hi, someone, i tried :

const mynum = [5, 6, { name: 'Sam', sch: 'FUPRE' }, 6, 4];

const mappedNum = mynum.map((element, indx, arr) => 

  //  element * indx === NaN ? 0 : element * indx  // not working

   isNaN(element * indx) ? 0 : element * indx // works

);

console.log(mappedNum); // but mynum[2] * any number === NaN

mynum[2] * 2 === NaN ? console.log('not a number') : console.log('sam'); // but this works

Why does element * indx === NaN ? 0 : element * indx not working , but mynum[2] * 2 === NaN ? console.log('not a number') : console.log('sam'); // but this works.
isNaN worked pretty well, and that has prompted me to want to know why.
Thanks in advance.

NaN === NaN is false, it’s a behaviour of NaN that must be accepted as it is

in both your ternary operators it is the else statement that is always executed