Current location - Training Enrollment Network - Mathematics courses - What is the return value of NaN == NaN in javascript?
What is the return value of NaN == NaN in javascript?
NaN is a value type, which means not a number. Everyone knows what it means. The value is special because NaN is a number, which is not equal to any number.

JavaScript:alert(type of(NaN)); It can be completely proved that this is a numerical value. In other words, NaN is a wrong strategy when it is converted into a number that no one knows. From this point of view, it can be mathematically understood as infinity or infinitesimal. But this goes against a theory in mathematics. We often say that adding 1 to infinity is wrong. Just not adding 1 does not equal infinity.

In javascript, because NaN is infinite, it is no longer a value, but a value, so it can sometimes be regarded as a type.

This is a marginal problem, so it is correct to conduct the following tests:

JavaScript:alert(NaN+ 1); The result is infinity.

But the only thing is that NaN is an uncertain number, so NaN can't be equal to NaN.

Just like random, random+1 is still an uncertain number in randomise, but random will not be equal to random. The difference between them is that randomness can produce a certain number, but it is uncertain. NaN generates an uncertain number.