Return to Snippet

Revision: 34126
at October 17, 2010 20:52 by resting


Initial Code
function decimalToHex(d, padding) {
  var hex = Number(d).toString(16);
  padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;

  while (hex.length < padding) {
      hex = "0" + hex;
  }

  return hex;
}

Initial URL

                                

Initial Description
Taken online

Initial Title
Convert Decimal to Hex

Initial Tags

                                

Initial Language
JavaScript