Smal SEO Tool

JavaScript Numbers

JavaScript has only one type of number. Numbers can be written with or without decimals.

javascript
let x = 3.14;    // A number with decimals
let y = 3;       // A number without decimals

NaN - Not a Number

NaN is a JavaScript reserved word indicating that a number is not a legal number.

Trying to do arithmetic with a non-numeric string will result in NaN:

javascript
let x = 100 / "Apple";  // x will be NaN

Test Yourself with an Exercise

What does NaN stand for?