+ 1
Why when compare NaN it return always false ?
var n1 = 5 * "hossam"; var n2 = 5 * "hossam"; console.log(n1 === n2); //false console.log(n1 == n2); // false Why ???
4 Answers
+ 5
In terms of accepting NaN != NaN, something which is not a number is not necessarily equivalent to something else which also isn't a number. All in all, like Jomari pointed out, NaN is just designed to fail the equality test since NaN does not refer to anything specific.
+ 2
That's just the way how it was configured. NaN will fail every equality check to any value including to itself.
+ 1
I won't use it for compare but all what I want know is what behind seen ? ... for ex: int x = new Int(5);
Int y = new Int(5);
Both not equal coz different in memory address ... etc