mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
@ -13,7 +13,7 @@ function intToHex (num) {
|
||||
function decimalToHex (num) {
|
||||
const hexOut = []
|
||||
while (num > 15) {
|
||||
hexOut.push(intToHex(num % 16))
|
||||
hexOut.unshift(intToHex(num % 16))
|
||||
num = Math.floor(num / 16)
|
||||
}
|
||||
return intToHex(num) + hexOut.join('')
|
||||
|
Reference in New Issue
Block a user