[thelist] javascript parseInt (TIP)

sam foster potatosculptor at gmail.com
Fri Sep 15 11:51:07 CDT 2006

A tip owed for my lengthy absence from this fantastic community.

<tip type="javascript parseInt">
Occassionaly we are reminded of the value of reading the spec, even
for those languages we are most familiar with. I just ran into an odd

parseInt("07") == 7 // as I would expect.
parseInt("08") == 0; // ??

Of course, parseInt takes a second argument, the *radix* which is to
disambiguate which base this integer is in. So, parseInt("08", 10)
returns 8. Back to normality.

More information about the thelist mailing list