Method Number.toHex
Return the hexidecimal string representation of an integer
-
Syntax
String Number.toHex()
Convert a decimal integer to a hexidecimal string. - Return value The hexidecimal string representation of the decimal integer.
-
Examples
- Convert 255 to hex
// Declare variable var n = 255; // Output is FF n.toHex();
- Resources See also the native toString method of the Number object which will let you convert numbers to any base.
-
Download
Source
Unless otherwise noted all code in the JSLab Standard Library is licensed as GPLv3. See http://www.gnu.org/licenses/gpl.html for the entire license.
This function has dependencies and will not work stand-alone. Use the download button above instead of copy/paste.
