Usage of Javascript parseint () and parsefloat ()

Source: Internet
Author: User

    • The parseint () method first looks at the character at position 0, determines if it is a valid number, and if not, the method returns Nan, and no further action is taken. However, if the character is a valid number, the method will look at the character at position 1 and perform the same test. This process continues until a character is found that is not a valid number, at which point the parseint () converts the string before the character to a number.

    • parsefloat () method view each character starting at position 0 until the first non-valid character is found, and then convert the string before the character to a number.
      However, for this method, the first decimal point that appears is a valid character. If there are two decimal points, the second decimal point will be considered invalid,

Usage of Javascript parseint () and parsefloat ()

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.