converting various values to boolean and verify how JavaScript behaves.
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
//if you try following line of code in chrome console | |
var a = new Boolean(undefined); | |
console.log(a); | |
//false | |
a = new Boolean(null); | |
console.log(a); | |
//false; | |
a = new Boolean(0); | |
console.log(a); | |
//false | |
a = new Boolean('0'); | |
console.log(a); | |
//false | |
a = new Boolean(false); | |
console.log(a); | |
//false; | |
a = new Boolean('false'); | |
console.log(a); | |
//true | |
a = new Boolean(NaN); | |
console.log(a); | |
//false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment