Possible Duplicate:
Workarounds for JavaScript parseInt octal bug
Why does
parseInt("09")
return 0 but
parseInt("07")
return 7?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The base for strings starting with
0can be octal (when a radix is not specified – and depending on the browser).You are looking for:
See the documentation for
parseInt:The comments for the
radixoptional parameter (the second one in my example) says this: