Last active
April 26, 2024 15:47
-
-
Save samme/af3dbb5aaee5d44cec3d86eedb6894fa to your computer and use it in GitHub Desktop.
Hexadecimal number/string conversions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 0x00000f (15) to '#00000f' | |
'#' + (0x00000f).toString(16).padStart(6, '0') | |
// '#00000f' to 0x00000f (15) | |
parseInt('0x' + '#00000f'.slice(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment