map for decimal to hexa , 0 - 9 are straightforward , alphabets a - f used for 10 to 15.
let m = new Map ( ) ; let digit = ' ' . charCodeAt ( 0 ) ; let c = ' ' . charCodeAt ( 0 ) ; for ( let i = 0 ; i <= 15 ; i ++ ) { if ( i < 10 ) { m . set ( i , String . fromCharCode ( digit ) ) ; digit ++ ; } else { m . set ( i , String . fromCharCode ( c ) ) ; c ++ ; } }