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
new Number(12)使变量类型为数字并为其设置值12
Numbers have low and high limits. We can them MAX_VALUE which is 1.7976931348623157E+308 and MIN_VALUE 5E-324 .
数字有上限和下限。 我们可以将它们设为MAX_VALUE ,即1.7976931348623157E + 308和MIN_VALUE 5E-324。
NaN means Not a Number and used for non number types.
NaN表示不是数字,用于非数字类型。
获取数字值 (Get Value of Number)
To get primitive value of a number valueOf function can be used.
要获取数字的原始值,可以使用valueOf函数。
Code:
码:
var count= new Number(12);
console.log(count.valueOf());
Output:
输出:
12
翻译自: https://www.poftut.com/javascript-numeric-variable-type-integer/