I’m just spitballing here, but NaN is basically not a value itself, more of an error state. Personally, I would much prefer that parseInt throw an error that I need to handle rather than become a useless “value” (that you should handle anyway, it’s just less explicit).
But if NaN were equal to itself then this kind of weird stuff could happen:
const userInput = "foo"
const otherUserInput = "bar"
if (parseInt(userInput) === parseInt(otherUserInput)) {
// do something unexpected if NaN equals NaN
}
Yup. You really, really never want to say that two NaNs are equal since there is a huge number of ways to make a NaN. Your code starts to do surprising stuff if that is all.