Skip to content

Instantly share code, notes, and snippets.

@defel
Created June 30, 2010 16:13
Show Gist options
  • Save defel/458879 to your computer and use it in GitHub Desktop.
Save defel/458879 to your computer and use it in GitHub Desktop.
// Plausible code
[] == 0 // true
+[] === 0 // true, wait whu?
++[] === 1 // sorta, though this is invalid js syntax, so...
// Somewhat unlikely and, lets be honest, regrettable code:
[[]][0] === []
++[[]][0] === 1
++[[]][+[]] === 1 // yay! wtf!
// [John Resig explains 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