snippetjavascriptCritical
How to convert decimal to hexadecimal in JavaScript
Viewed 0 times
howconvertdecimalhexadecimaljavascript
Problem
How do you convert decimal values to their hexadecimal equivalent in JavaScript?
Solution
Convert a number to a hexadecimal string with:
And reverse the process with:
hexString = yourNumber.toString(16);And reverse the process with:
yourNumber = parseInt(hexString, 16);Code Snippets
hexString = yourNumber.toString(16);yourNumber = parseInt(hexString, 16);Context
Stack Overflow Q#57803, score: 3274
Revisions (0)
No revisions yet.