Last active
December 27, 2015 12:09
-
-
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!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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