Skip to content

Instantly share code, notes, and snippets.

@kistaaa
Last active April 29, 2023 22:07
Show Gist options
  • Save kistaaa/09ab7fff8853c81a3590633c26aa61bd to your computer and use it in GitHub Desktop.
Save kistaaa/09ab7fff8853c81a3590633c26aa61bd to your computer and use it in GitHub Desktop.
JS numbers to HEX and reverse
const hex = (num) => num.toString(16).padStart(2, '0')
const num = (hex) => parseInt(hex, 16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment