Created
April 26, 2012 18:13
-
-
Save markmarkoh/2501584 to your computer and use it in GitHub Desktop.
Rick Ford!!
This file contains hidden or 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
| /* | |
| Equality operators: ===, !== vs. ==, != | |
| The second set are the 'evil twins'. They attempt to coerce values, | |
| but do a real crap job of it. | |
| Evidence: | |
| */ | |
| '' == 0 // true | |
| 0 == '0' // true | |
| // therefore '' equals '0'? Right? Right??? Wrong: | |
| '' == '0' // false. | |
| '' == 0 // true | |
| 0 == ' \t\r\n ' // true | |
| // same punchline as above: | |
| '' == ' \t\r\n ' // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment