Javascript Number Object

Source: Internet
Author: User

Number ("");   // 0 Number ("DF");  // if it cannot be converted to a number, it returns Nan

Number method:

Number.isNaN()  0/0 → NaN   该方法不会强制将参数转换成数字,只有在参数是真正的数字类型,且值为 NaN的时候才会返回 true
Determines whether the passed value is NaN.
Number.isFinite()
Determines whether the value type passed and itself is a finite number.
Number.isInteger()
Determines whether the value type passed is "number" and is an integer.
Number.isSafeInteger()
Determine whether the passed value is a safe integer (number between -(253 - 1) and 253 - 1 ).
Number.toInteger()
computes the passed value and converts it to an integer (or infinity).
Number.parseFloat()   parseFloat()方法将参数中指定的字符串解析成为一个浮点数字并返回
The same as the global object parseFloat() .
Number.parseInt()   parseInt() 函数将给定的字符串以指定基数(radix/base)解析成为整数
The same as the global object parseInt() .
parseint (stringradix);

Javascript Number Object

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.