mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 17:50:39 +08:00
Update DecimalToHex.js
updated as per `standard.js`
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
function intToHex(num) {
|
function intToHex (num) {
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case 10: return 'A'
|
case 10: return 'A'
|
||||||
case 11: return 'B'
|
case 11: return 'B'
|
||||||
@ -10,7 +10,7 @@ function intToHex(num) {
|
|||||||
return num
|
return num
|
||||||
}
|
}
|
||||||
|
|
||||||
function decimalToHex(num) {
|
function decimalToHex (num) {
|
||||||
const hexOut = []
|
const hexOut = []
|
||||||
while (num > 15) {
|
while (num > 15) {
|
||||||
hexOut.unshift(intToHex(num % 16))
|
hexOut.unshift(intToHex(num % 16))
|
||||||
|
Reference in New Issue
Block a user