NaN and Infinity
Special number values.
Examples
NaN Calculation
Arithmetic with non-numeric strings results in NaN.
let x = 100 / "Apple";
console.log(x); // NaN
console.log(isNaN(x)); // trueInfinity
Reaching Infinity by repeated multiplication.
let myNumber = 2;
while (myNumber != Infinity) {
myNumber = myNumber * myNumber;
}
console.log(myNumber); // InfinityTest Your Knowledge
JavaScript Quiz
No quiz available for this topic yet.