Alert formatted as hexadecimal in JavaScript

Posted by Chris_45 on Stack Overflow See other posts from Stack Overflow or by Chris_45
Published on 2010-04-09T13:34:09Z Indexed on 2010/04/09 13:43 UTC
Read the original article Hit count: 338

Filed under:
|
|

How do I alert as FF and not 255 with this:

var myHex1 = 0xff;  
alert(myHex1);//alerts 255


var myVar = 255;
var myHex2 = myVar.toString(16);
alert(myHex2);//also alerts 255 and not FF

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about alert