Javascript parseInt('08') and parseInt('09')

by Jack K

This one's not jQuery-specific but futzed with my mind yesterday and should probably be on any javascript developer's radar:

http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C85006A6604

If you're ever wondering why parseInt isn't working with '08' or '09', this is why. Ue parseFloat instead.

[2 cents] Argggh! And thanks much to the original poster. If I hadn't found that post I'm not sure how long it would have taken me to narrow down that bug (I was working on a js function for reading data from a USB credit card swiping gizmo and the routine to parse the data wasn't working for months '08' and '09'). Good find.

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)