Browse - Programming Tips - How can I convert a number to hex (hexadecimal)?

Date: 2014oct13
Language: javaScript

Q.  How can I convert a number to hex (hexadecimal)?

A.  Its built-in to the language:

var num = 255; var asHex = num.toString(16); // becomes base-16 (hex) console.log("num is " + asHex + " in hex");