hexadecimal

Hexadecimal numbers

Hexadecimal colour values

This example demonstrates how Javascript can convert between hexadecimal and decimal numbers by prefixing a (hexadecimal) number with 0x. When a hexadecimal number is parsed, it outputs is decimal equivalent.

This little trick avoids having to write a function to do the conversion.

Syndicate content