So had to dig down to the code base and start debugging. Finally I figured out that it was a error due to Javascript string to int conversion. Consider these examples.
-
parseInt('08',10) // 8 -
parseInt('8',8) // 0 -
parseInt('08') // 0
-
parseInt('123.45') // 123 -
parseInt('77') // 77 -
parseInt('077',10) // 77 -
parseInt('77',8) // 63 (= 7 + 7*8) -
parseInt('077') // 63 (= 7 + 7*8) -
parseInt('77',16) // 119 (= 7 + 7*16) -
parseInt('0x77') // 119 (= 7 + 7*16) -
parseInt('099') // 0 (9 is not an octal digit) -
parseInt('99',8) // 0 or NaN, depending on the platform -
parseInt('0.1e6') // 0 -
parseInt('ZZ',36) // 1295 (= 35 + 35*36)
No comments:
Post a Comment