Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
user24
on Feb 13, 2013
|
parent
|
context
|
favorite
| on:
Opera moves to WebKit
Got to admit, I am disappointed that
> parseInt("08", 8);
returns 0 instead of NaN
nemetroid
on Feb 13, 2013
[–]
Returning 0 makes perfect sense. parseInt matches an integer
from the beginning of the string
, so it reads the 0 and then stops at the 8 because 8 is not a valid digit in base 8.
>>> parseInt("123foobar", 10) 123
user24
on Feb 14, 2013
|
parent
[–]
Good point.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
> parseInt("08", 8);
returns 0 instead of NaN