Thursday, August 05, 2010

Convert a character to hex using javascript

There are lots of massive solutions to this - here's a 0.2 second solution ( I am posting this because I saw this )

"x.charCodeAt(0).toString(16).toUpperCase()" is the hex of x. Use charCodeAt(i) for a full string (parseInt otherwise).

I realize that this is trivial. It is stupid. It can be done in many ways, most of which are ridiculously easy.

Unfortunately, people are failing to do even this. Meh, more proof for the FizzBuzz statistic.

No comments: