this post was submitted on 05 Aug 2025
121 points (98.4% liked)

Programmer Humor

37634 readers
333 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
 

That's it. That's the meme.

you are viewing a single comment's thread
view the rest of the comments
[–] Telemachus93@slrpnk.net 8 points 2 days ago (1 children)

It's not. Just tried in my Browser Console:

2 == true // returns false
[–] retrolasered@feddit.uk 6 points 2 days ago (2 children)

I genuinely wasn't aware of that. I must be getting javascript confused for almost any other language. I wonder how many times ive !!'d a value to make that work without actually absorbing that into my head now..

[–] Excel@beehaw.org 3 points 2 days ago

2 is not == true, but !!2 is true

[–] Telemachus93@slrpnk.net 3 points 2 days ago (1 children)

In other languages that shouldn't be equal either though, right?

Maybe you meant

if (2){
console.log("nonzero ints are truthy")
}
else {
console.log("no they're not")
}

Which would output

nonzero ints are truthy

and that would actually work in all languages I know. But that's different from being equal.

[–] retrolasered@feddit.uk 2 points 1 day ago

Yeah its checking for not null with if isnt it. Maybe thats what has me confused