Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of the script.aculo.us user interface JavaScript library, a member of the Prototype core team and a Ruby on Rails core alumnus.
You're using my JavaScript work every day, even if you're not aware of it!
   Need corporate training or want me to speak at your conference? Contact me!

When JavaScript makes no sense

July 28th, 2010

Here are some of the more weird things I’ve found over the years when using JavaScript.

My most favorite quirk ever is:

typeof NaN
// => number

Recently, I stumbled upon the “magic increasing number”:

9999999999999999
// => 10000000000000000

And this is from my article on number parsing:

parseInt("01") // --> 1
parseInt("02") // --> 2
parseInt("07") // --> 7
parseInt("08") // --> 0
parseInt("09") // --> 0

There’s an extensive collection of these and more at wtfjs, so go check it out! Some are pretty obvious in hindsight, but some are really, really obscure.

If you think you know everything about JavaScript, you probably don’t… What’s your favorite JavaScript quirk?