Created
December 9, 2011 03:48
-
-
Save jrmoran/1450065 to your computer and use it in GitHub Desktop.
Weird JS
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
p = console.log; | |
// # objects are truthy | |
var b = new Boolean(); // Never use the Boolean constructor | |
p( b.toString() ); // 'false' | |
p( b == false ); // true, use strict equality comparison with === | |
p( b === false ); // false | |
p( b ? 'yeah' : 'nope' ); // yeah | |
p( typeof b ); // object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment