JsparseInt ("08") does not specify the Carry System _ javascript skills
Source: Internet
Author: User
If you are making a JS judgment on the month today, you can get the correct result from parseInt (& quot; 01 & quot;) to parseInt (& quot; 07 & quot, if it is parseInt (& quot; 08 & quot;) or parseInt (& quot; 09 & quot;), 0 is returned. First, check the parseInt Syntax: parseInt (string, radix ); here, string is the string to be converted, and radix is binary, octal, hexadecimal or decimal.
When radix is not specified by default, it is in hexadecimal format when 0x is switched. If 0 is switched and the second digit is not x, it is in octal format, (the error 0 is returned because there cannot be 8 or 9 in octal ).
Therefore, we should specify the carry-in system to avoid errors.
If we usually use decimal digits, we will use parseInt ("08", 10 );
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.