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