This explains what NaN is, but not the reason why Brendan Eich came up with it, which is: in algebraic functions, there may be undefined results, for example Math.sqrt(-1). If one would be handling these results as undefined, they would be coerced to zero in further operations, which could lead to results that are mistaken for correct ones. Thus every mathematical operation with NaN yields NaN and comparisons always fail.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This explains what NaN is, but not the reason why Brendan Eich came up with it, which is: in algebraic functions, there may be undefined results, for example
Math.sqrt(-1)
. If one would be handling these results as undefined, they would be coerced to zero in further operations, which could lead to results that are mistaken for correct ones. Thus every mathematical operation with NaN yields NaN and comparisons always fail.