Number types are used to express countable data. Numbers will presents integer, floating-point and dates. From technical point there is no difference between integer and floating-point.
Numbers can be defined explicitly like below.
var count= new Number(12);
- var count creates and variable
- new Number(12) makes variable type number and set value 12 to it
Numbers have low and high limits. We can them MAX_VALUE which is 1.7976931348623157E+308 and MIN_VALUE 5E-324 .
NaN means Not a Number and used for non number types.
Get Value of Number
To get primitive value of a number valueOf function can be used.
Code:
var count= new Number(12); console.log(count.valueOf());
Output:
12