parseInt('07')=='7', but parseInt('08')=='0'? why?
- by KOHb
Here's a simple script that gives a strange result:
alert(parseInt('01')+' - '+parseInt('02')+' - '+parseInt('03')+' - '+parseInt('04')+' - '+parseInt('05')+' - '+parseInt('06')+' - '+parseInt('07')+' - '+parseInt('08')+' - '+parseInt('09')+' - '+parseInt('10'));
I would expect it to give 1 - 2 - 3 and so on, but it gives me this (in FireFox, Chrome and IE6):
1 - 2 - 3 - 4 - 5 - 6 - 7 - 0 - 0 - 10
Can someone please explain me why?