Skip to content

Instantly share code, notes, and snippets.

@a1exlism
Created March 18, 2018 07:59
Show Gist options
  • Save a1exlism/d0f8434e901403248452a0bfa7ec68e2 to your computer and use it in GitHub Desktop.
Save a1exlism/d0f8434e901403248452a0bfa7ec68e2 to your computer and use it in GitHub Desktop.
// Convert a number to a hexadecimal string with:
hexString = yourNumber.toString(16);
// and reverse the process with:
yourNumber = parseInt(hexString, 16);
// Example
// (255).toString(16) == 'ff' && parseInt('ff', 16) == 255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment