If decimal numbers contain a leading zero, it's always best to specify the radix as 10 so that you won't accidentally end up with an octal value. : Type Conversion : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » Type Conversion »

 

If decimal numbers contain a leading zero, it's always best to specify the radix as 10 so that you won't accidentally end up with an octal value.













var iNum1 = parseInt("010");        //returns 8
var iNum2 = parseInt("010"8);     //returns 8
var iNum3 = parseInt("010"10);    //returns 10







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» Type Conversion