r/ProgrammerHumor 21h ago

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.5k Upvotes

270 comments sorted by

View all comments

7

u/Serotav 20h ago

nha js can do it aswell, try:

let a = new Boolean(false)

if (a) {
console.log("it was true indeed")
}

1

u/circ-u-la-ted 18h ago

Not really the same thing—you're explicitly instructed not to use `new` in that statement because all objects in JS coerce to `true`.

2

u/Reashu 17h ago

Ruby has docs too. false and nil are the only false-values.

Both are surprisingly truthy values and JS is (as usual) more surprising. 

1

u/prehensilemullet 16h ago

No competent JS developer that I’ve heard of has ever touched primitive boxes like new Boolean