October 15, 2000 - Converting Zero-Leading Strings to Integers
![]() |
October 15, 2000 Converting Zero-Leading Strings to Integers Tips: October 2000
Yehuda Shiran, Ph.D.
|
parseInt("009");
yields zero (0). You can get around it by specifying a radix of 10. For example:
parseInt("009", 10);
yields 9. Specifying any other radix which is smaller than 10 will yield zero (0). Try it:
This tip has been contributed by KP.


Find a programming school near you