Number Data Type JavaScript Tutorial

When using Number's toString() method in radix mode, it is possible to output the number using a different base, such as 2 for binary, 8 for octal, or 16 for hexadecimal.
This functionality is useful for dealing with numbers in HTML.
HTML uses hexadecimal representations for each color.

var iNum = 10;
alert(iNum1.toString(2));
alert(iNum1.toString(8));
alert(iNum1.toString(16));