This is pretty interesting how you can convert not just standard decimal or hexadecimal numbers but any number with base between 2 and 32. Here’s how:
Dec to Hex:
var myDecimalNum = 10; myDecimalNum.toString(16); result : a
Hex to Dec:
var myHexNum = "a"; parseInt(myHexNum,16); result : 10
And not just base 16 (hex), you can do it for any base. Try different bases and have fun.