Mostrando postagens com marcador Javascript. Mostrar todas as postagens
Mostrando postagens com marcador Javascript. Mostrar todas as postagens

21 de fev. de 2011

How to convert Hexadecimal to Decimal in Javascript?

 

Convert Hexadecimal to Decimal is very simple, see below:

var h = 'FE';
d = parseInt(h,16);
//To create a function to do this:
function h2d(h) {return parseInt(h,16);}

How to convert decimal to Hexadecimal in Javascript?

 

There is a simple for to do this:

var d = 20
d.toString(16);
If you want to create a function, below is an example:
function d2h(d) {return d.toString(16);}