// function to convert decimal to hexadecimal
function convertToHex(element,index,array) {
return element.toString(16);
}
var decArray = new Array(23, 255, 122, 5, 16, 99);
var hexArray = decArray.map(convertToHex);
alert(hexArray); // 17,ff,a,5,10,63
function HEX(num) {return num.toString(16)}
//hex is also known as base 16 so you just say var.toBase16String