Javascript数字变量类型整数

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
LEARN MORE  How To Convert List To String in Python?
了解更多如何在Python中将列表转换为字符串?

翻译自: https://www.poftut.com/javascript-numeric-variable-type-integer/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值