javascript Boolean

Boolean data type has value true or false. To check a variable is true of false, Boolean() can be used.

var x=true;
Boolean(x); //true
var y=false;
Boolean(y); //false

Boolean() can check whether an expression is true of false.
Boolean( 3 > 5); //false
var x="endmemo";
Boolean( x.indexOf('d')); //true

All values, strings and real statements are true.
Boolean(-1); //true
Boolean(5); //true
Boolean(97.3); //true
Boolean("endmemo"); //true
Boolean(9 > 8); //true

null,0,empty string and undefined variables etc are false.
Boolean(0); //false
Boolean(""); //false
Boolean(null); //false
Boolean(4/0); //false
var x;
Boolean(x); //false