Skip to content

Instantly share code, notes, and snippets.

@actsasbuffoon
Last active December 27, 2015 12:09
Show Gist options
  • Save actsasbuffoon/7323667 to your computer and use it in GitHub Desktop.
Save actsasbuffoon/7323667 to your computer and use it in GitHub Desktop.
We've replaced Michael's JavaScript interpreter with Cthulhu. Let's see if he can tell the difference!
// Let's have some fun with JavaScript.
{} + 0
// => 0
// That's a little strange, but okay. Surely nothing would change if I wrapped
// the whole thing in parens, right?
({} + 0)
// => "[object Object]0"
// Okay, that's weird. Let's see if strict equality can tell the difference
// between the two.
{} + 0 === ({} + 0)
// => false
// Good, at least JavaScript isn't completely sadistic. Surely the result would
// be the same if I compared them in the opposite order...
({} + 0) === {} + 0
// => true
// Welcome to JavaScript; where a == b && b != a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment