Falsy Bouncer and Boolean Objects

about to start on this:
Link to the challenge:

however, when i clicked the “helpful links” i see this:
“Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object.”- Boolean Objects

sounds like double talk to me.
as far as i can tell, it’s like saying “don’t confuse ‘coffee’ with ‘coffee’.”
what is the difference?
anyone able to dumb it down for me, please?

This can be kinda weird but the fundamental idea here is Boolean *Object*
So, true != Boolean(true) because they aren’t the same :slight_smile:

Primitive boolean values are just true and false. You can coerce other values to a boolean primitive using the Boolean function:

var b = Boolean(20); // true
var c = Boolean(''); // false
var d = Boolean({}); // true

Boolean objects on the other hand are basically objects that contain a primitive boolean value. They are created when you do something like:

// (notice the `new` keyword. Using that keyword always gives you an object).
var b = new Boolean(20);

Most of the time a Boolean object is not what you want. When you convert any object in JS to a boolean primitive, you always get true. That includes Boolean objects, even if they contain false in them!

var b = new Boolean(false);
if (b) {
  console.log('I get printed!');
1 Like