var b1 = new Boolean(y); // Boolean object
var b2 = true;           // Boolean primitive
var b3 = Boolean(x);     // Boolean primitive

If value is omitted or is 0, -0, null (not 'null'), false (not 'false), NaN (not 'NaN'), undefined (not 'undefined'), or an empty string ("" or ''), then the object has an initial value of false. All other values, including any object (besides null) will create a Boolean object with an initial value of true.

A Boolean object is not the same as the primitive Boolean values of true and false.

A Boolean object is not the same as the Boolean function.

x = new Boolean(false); eval(x); // Evaluates as an object or true
x = false; eval(x)               // Evaluases as false
x = new Boolean(y) // don't use
x = Boolean(y)     // preferred


GeorgeHernandez.comSome rights reserved