If you get string input of numbers in a representation other than
decimal representation you can use
parseInt('string', numberBase)
to convert that input to a decimal number for example
var sixteenHex = '10';
var sixteen = parseInt(sixteenHex, 16);
to convert from hex to decimal,
var sixteenBinary = '10000';
var sixteen = parseInt(sixteenBinary, 2);
to convert form binary to decimal,
var sixteenOctal = '20';
var sixteen = parseInt(sixteenOctal, 8);
to convert from octal to decimal.