If you're looking for a generic solution, you will want to use parseInt()
:
var x = parseInt("1234567890"); // automatic base detection
var x = parseInt("777", 8); // force octal base (511)
Note that although the radix argument is optional, it's a good practice to always include it, i.e.:
parseInt("09"); // may fail
parseInt("09", 10); // always 9
If you're only looking for base-10 and base-16 conversions:
+"1234" // 1234
+"0xf" // 15