JS: Number
Decimal Number Syntax
console.log( 123 ) console.log( 123. ) console.log( 123.0 ) console.log( 123.45 )
Number Separator
Numbers can have separator lowline _ between digits.
console.log(1_000 === 1000);
Input Binary, Hexadecimal, Octal, Scientific
NaN and Infinity
Number value also includes
NaN
and
Infinity
Number Type
Number is a type of Primitive Value
No Type Distinction of Integer and Float
In js, there is no different types for integer and float. They are just number type.
console.log(typeof 3 === "number"); // true console.log(typeof 3.2 === "number"); // true