Hexadecimal in javascript

Something Like that:
0xFF

JavaScript interprets numeric constants as hexadecimal if they are preceded by 0x.
For example I want to write number like 255
0xFF

For that you need to create first html code.

HTML

<p id="demo"></p>

After that add this JS code.

JS

var x = 0xFF; 
document.getElementById("demo").innerHTML = x;

[codepen_embed height=”265″ theme_id=”0″ slug_hash=”prjpew” default_tab=”js,result” user=”pradeepanvi”]See the Pen Hexadecimal in javascript by Pradeep Kumar (@pradeepanvi) on CodePen.[/codepen_embed]

Now you can see

255

Leave a Reply

Your email address will not be published. Required fields are marked *