Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of script.aculo.us, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Noko Time Tracking and Every Time Zone and write books like Retinafy.me.
   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?