I think the first condition should be true, Because the argument for parameter x is Number.Nan. And it surely equals with the other Namber.Nan within the first conditional if. But I'm wrong apparently. Why? What is the value of x when it is comparing to Number.NaN?
function clean(x) {
if (x === Number.NaN) {
// can never be true
return null;
}
if (isNaN(x)) {
return 0;
}
}
console.log(clean(Number.NaN));
// expected output: 0