Question

Found out a strange thing in IE8:

parseInt('01')
//1
parseInt('02')
//2
parseInt('03')
//3
/*...*/
parseInt('07')
//7
parseInt('08')
//0 !!!
parseIntr('09')
//9 ok

Can someone clarify?

Était-ce utile?

La solution

Use radix

parseInt('08', 10)
//8
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top