Home >Web Front-end >JS Tutorial >js parseInt('08') does not specify the carry system_javascript skills

js parseInt('08') does not specify the carry system_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:25:02952browse

Where string is the string to be converted, and radix is ​​binary, octal, hexadecimal or decimal.
When radix is ​​not specified by default, when it is switched with 0x, it is hexadecimal; if it is switched with 0 and the second digit is not x, it is octal (because octal cannot have 8 or 9, so an error is reported Return 0).
So, we should clearly specify the carry system when we use it to prevent errors.
If we usually use decimal digits, we use parseInt("08", 10);

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn