- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript NaN
JavaScript Type System
JavaScript NaN
NaNmeans Not a Number, and it is the result of a failed number operation.
Confusingly, typeof NaN is number.
It is a number value that represents an impossible result.
Example
Example
javascript
const result = Number("hello");
console.log(result);
console.log(typeof result);The output is NaN then number.
What Produces NaN
Converting text that is not a number.
Arithmetic with a value that cannot be converted.
Mathematically undefined results, such as 0 / 0.
