Skip to content

Instantly share code, notes, and snippets.

@getify
Created February 26, 2010 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save getify/316313 to your computer and use it in GitHub Desktop.
Save getify/316313 to your computer and use it in GitHub Desktop.
[] == 0
+[] === 0
++[] === 1 // sorta, though this is invalid js syntax, so...
[[]][0] === []
++[[]][0] === 1
++[[]][+[]] === 1 // yay! wtf!
// FYI: this comes from John Resig explaining here:
// http://news.ycombinator.com/item?id=1154338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment