Skip to content
DevMeme

JavaScript's Schrödinger's Boolean: Both True and False — Meme Explained

JavaScript's Schrödinger's Boolean: Both True and False
View this meme on DevMeme →

Level 1: False in a Box

Imagine you have a piece of paper that says “No” (like the word false). If you show just that paper, it clearly means “No.” But now put that paper inside a little box. If someone asks “Do you have something?”, you’d answer “Yes, I have a box” — the box itself counts as something (like a “true” thing) even though it’s holding a “No” inside. If you then put that box inside a bigger box, you’re still holding something, so you’d again answer “Yes!”. By wrapping a “No” inside one and then two layers of boxes, from the outside it weirdly looks like a “Yes.” This meme is playing with exactly that idea: in JavaScript, if you wrap a false value inside a box (an object), it acts true. Do it twice and it’s like you magically turned “No” into “Yes” just by adding boxes. It’s funny (and a bit absurd) because normally we don’t expect that you can change the meaning of false just by packaging it differently!

Level 2: True vs Truthy

In JavaScript, any value can be used in a condition (like an if statement), and values are classified as either truthy or falsy. Put simply, falsy values behave like false, and truthy values behave like true when evaluated in boolean contexts. The falsy list is short and memorable:

  • false (of course)
  • the number 0 (and -0, an edge-case)
  • "" (an empty string)
  • null and undefined
  • NaN (a special “not a number” value)

Everything else is truthy — which means it counts as true in an if or similar check. Importantly, any object is truthy in JavaScript, even an object that represents a negative or false concept.

Now, JavaScript has a quirk with its Boolean type. You can use Boolean as a function or as a constructor. If you call Boolean(x) as a regular function (without new), it will convert x into a simple true/false primitive. For example, Boolean(0) returns false, and Boolean("hello") returns true. But if you call new Boolean(x), you create a Boolean object instead of a primitive. That object contains a boolean value inside it, but because it’s an object, JavaScript treats it as truthy by default.

So if you do new Boolean(false), you get an object that holds the value false. However, if you use that object in a conditional, it will act as true, not false. You basically put the false inside a wrapper (an object), and the language only sees “hey, this is an object, that’s something!” and so it treats it as true. For example:

if (new Boolean(false)) {
  console.log("This executes, because the object is truthy!");
} else {
  console.log("This will never run.");
}

Even though the Boolean object was created with false inside, the if condition treats it as true, so the first branch runs. The meme takes this one step further: new Boolean( new Boolean(false) ). Here the inner part, new Boolean(false), as we saw, is a truthy object. So it’s like doing new Boolean(truthyValue), which will create a Boolean object set to true internally. The console screenshot is showing exactly that outcome: the first evaluation results in a Boolean {false}, and the second results in a Boolean {true} after nesting.

For someone new to JavaScript, this is pretty confusing! It highlights a sneaky difference between true and truthy. The meme essentially jokes, “look, I’ve leveled up my understanding of JavaScript’s weirdness!” It points out a type coercion surprise in a lighthearted way. In normal coding, you would just use the plain true or false values and avoid new Boolean entirely to prevent this kind of mix-up. But seeing it illustrated like this is a fun way to learn that even something as simple as booleans can have tricky behavior in JavaScript.

Level 3: True Lies

This meme highlights a notorious JavaScript type coercion oddity: using the Boolean constructor in a nested way to make false appear true. In the top panel (a browser console), the code:

new Boolean(false);               // Boolean {false}
new Boolean(new Boolean(false));  // Boolean {true}

produces a mind-bending result. The first line creates a Boolean object that contains the value false, and the console shows it as Boolean {false}. The second line wraps that object inside another Boolean constructor, yielding Boolean {true}. We’ve effectively flipped a false into true by double-wrapping it!

How is this possible? In JavaScript, the Boolean function can act in two ways. Call it like a regular function Boolean(x) and it will convert (coerce) x into a primitive true or false. But call it with the new keyword (new Boolean(x)) and it constructs a Boolean object instance. Here’s the quirk: all objects are truthy in JavaScript. It doesn’t matter if an object’s content is “false” – an object is a something, so it counts as true in boolean contexts. Thus, new Boolean(false) creates an object that holds false internally, yet if you check that object in an if statement or similar, it behaves as true. Nesting it one level further, new Boolean(new Boolean(false)) sees the inner object (which is truthy) and therefore produces an object with value true. This is a classic type-coercion trick, a truthiness edge-case that can flip logic on its head.

Seasoned developers can only shake their heads and laugh at this language quirk. It’s the kind of bizarre corner of the JavaScriptEcosystem you either learn from experience or hear about in programming folklore. We all quickly learn not to use new Boolean in real code (it’s almost always a bad idea unnecessary), because it leads to confusion exactly like this. But as a joke or trivia, it perfectly illustrates how language features can be unintuitive. It almost feels like turning two negatives into a positive in math or grammar: you take something false, wrap it up twice, and ta-da! it yields “true”. It’s not undefined behavior or a bug — the JavaScript spec explicitly defines it — but it sure can feel like a little magic trick (or a trap!) if you don't know what's happening.

The bottom panel with the bold “JavaScript 100” is a nod to the Elder Scrolls (Skyrim) game’s skill-leveling screen. It implies the person who pulled off this nested Boolean stunt has maxed out their JavaScript “truthiness” skill tree. Essentially, spotting and understanding this odd pattern is treated like an achievement unlock. Only a true JavaScript wizard (or someone who’s seen a lot of wacky code) would know that new Boolean(false) is always truthy. The meme humorously awards nerd cred for mastering such arcane knowledge. This is typical developer humor: taking a weird, rarely-used quirk of the language and framing it like you’ve discovered a secret cheat code in a game.

Comments (47)

  1. Anonymous

    This is why the senior dev on your team insists that `if (!!someObject)` is the only way to be sure. They've been hurt before

  2. Anonymous

    JavaScript: where one extra heap allocation can promote even false to middle management - proof that with enough abstraction, reality is negotiable

  3. Anonymous

    This is the same JavaScript quirk that made us add "5+ years experience with TypeScript" to job postings - not for the type safety, but to filter out developers who still think new Boolean(false) is a good idea after their third production outage

  4. Anonymous

    In JavaScript, even false becomes true once you give it an object - same career path as most middle managers

  5. Anonymous

    Ah yes, the classic JavaScript interview question that separates those who've been burned from those about to be. When you use `new Boolean(false)`, JavaScript helpfully creates an object wrapper - because apparently primitive booleans weren't confusing enough. Since all objects are truthy (even ones wrapping false), your carefully crafted `if (!myBool)` check suddenly fails in spectacular fashion. It's like JavaScript looked at C++'s operator overloading footguns and said 'hold my beer.' This is why ESLint has a rule against using Boolean/Number/String constructors with `new`, and why senior devs instinctively reach for `Boolean(value)` or `!!value` instead. Remember: in JavaScript, `new Boolean(false) == true` is false, but `new Boolean(false) ? true : false` is true. Because consistency is overrated when you can have *flexibility*

  6. Anonymous

    JavaScript is the only stack where a heap allocation turns false into true - thanks to ToBoolean’s “objects are truthy” rule, which is why eslint ships no-new-wrappers

  7. Anonymous

    new Boolean(false) is truthy because in JS, mere existence outweighs actual value - the ultimate architectural pattern for legacy tolerance

  8. Anonymous

    JavaScript in one line: box false, get an object; box the object, ToBoolean says true - autoboxing, the only promotion where false gets a raise

  9. dev_meme

    nonnull pointer -> true (at least in c++)

  10. @bezuhten

    seems legit

  11. @ShiningFlames

    Don't see any problem here :/

  12. @VladislavSmolyanoy

    It creates new instance → returns true because creating was successful I guess?

  13. @maggelia

    Yea that could be one of the only right things in JS, it's just telling you that indeed he did create it

  14. @Valeron933

    new operator probably returns non-zero value

  15. @SrZorro

    typeof new Boolean(true) is an object, and an object is true when casted to boolean

  16. @VladislavSmolyanoy

    Could it ever be false though?

  17. @SrZorro

    .value is undefined, if you want the typeof boolean value you have to use .valueOf

  18. @saidov

    Another noobie frontender JS meme making fun of JS

  19. @azizhakberdiev

    let num = 123 num.toString() // "123" 123.toString() // err 123..toString() //"123"

  20. @Agent1378

    LOL. Reminds of al of those nasty UDs in C....

Join the discussion →

Related deep dives