Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> defaults to base 10, whereas parseInt (at least histortically) does not.

To clarify for others (because this probably sounds crazy): The default is implicit like the rest of JavaScript, it will change base depending on presence of the prefixes 0x (16) and 00 (8), it doesn't seem to have included 0b yet. The confusing bit was octal because as you can imagine some sources might have base 10 padded with zeros, ES5 basically removes implicit octals in parseInt to avoid this issue.

Arguably this is more of a problem with the ambiguous octal prefix than the concept of using prefixes to determine base.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: