JavaScript basic Syntax 3

Source: Internet
Author: User

1. The so-called Nan, the English full name is not a number, indicating that it is not a count. If any one number and Nan are manipulated, the return is Nan

Will pop up Nan. Note: The data type of Nan is also number

Nan is not equal to any value, including itself

IsNaN (): Determines whether a parameter is not a number

2. Numeric conversions

Number (), parseint (), parsefloat ()

Number (): Converts a non-numeric value to a numeric value

If it is a Boolean value, it is either converted to 1 or converted to 0

If it's a number, then how much is that?

If it is a null value, it will be converted to 0

If it is undefined, it will be converted to Nan

The string is converted to a number:

If the string contains only numbers, it will only be converted to decimal.

If the string is empty, it will be converted to 0

If there is a letter, it will be converted to Nan

If the string is octal, the preceding 0 is ignored, but if it is 16, it is converted to the corresponding decimal number.

3.

parseint (): This function will see more of the number. If any, it will be converted to a number. If the string is empty, it will be converted to Nan. Another thing is that if it is 3.14, then it will be converted to 3.

Parsefloat (): The function can only parse 10 binary, so there is no second argument. Converts a string with a decimal point to a decimal number.

JavaScript basic Syntax 3

Related Article

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.