MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w49i01/ihatethispassiveagressivebehaviourruby/p760g4l
r/ProgrammerHumor • u/Embarrassed_Death69 • 21h ago
270 comments sorted by
View all comments
7
nha js can do it aswell, try:
let a = new Boolean(false)
if (a) { console.log("it was true indeed") }
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
1
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.
2
Ruby has docs too. false and nil are the only false-values.
false
nil
Both are surprisingly truthy values and JS is (as usual) more surprising.
No competent JS developer that I’ve heard of has ever touched primitive boxes like new Boolean
new Boolean
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")}