Number Data Type JavaScript Tutorial

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);