parseInt() in radix mode : Type Conversion : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » Type Conversion »

 

parseInt() in radix mode








The parseInt() method also has a radix mode, allowing you to convert strings in binary, octal, hexadecimal, or any other base into an integer.

The radix is specified as a second argument to parseInt().








var iNum1 = parseInt("AF"16);
var iNum1 = parseInt("10"2);
var iNum2 = parseInt("10"8);
var iNum2 = parseInt("10"10);







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» Type Conversion