I am trying to convert a DEC number to HEX using JavaScript.
The number I am trying to convert is 28.
I have tried using:
function h2d(h) {return parseInt(h,16);}
however it returns 40
I have also tried using:
function d2h(d) {return d.toString(16);}
however it returns 28
The final result should return 1C but I can't seem to work it out.
Does anyone know where I have gone wrong?