Use the Number toString() method:
toString()
let num = 255; /* w w w.ja va 2 s . c o m*/ // displays ff, which is hexadecimal equivalent for 255 console.log(num.toString(16));