this post was submitted on 25 Jan 2024
676 points (97.6% liked)

Programmer Humor

19197 readers
1292 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
676
=== (programming.dev)
submitted 7 months ago by JPDev to c/programmer_humor
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 47 points 7 months ago* (last edited 7 months ago) (24 children)

I still don't understand the === operator

Edit: I think a more type strict ==? Pretty sure I understand the point of typescript now.

[–] [email protected] 6 points 7 months ago (1 children)

The other comments explains it in pretty good detail, but when I was learning my teacher explained it sort of like a mnemonic.

1 + 1 = 2 is read "one plus one equals two"

1 + 1 == 2 is read "one plus one is equal to two"

1 + 1 === 2 is read "one plus one is really equal to two"

And you hit the nail on the head, is that === is type explicit while == is implicit.

[–] bobbykjack 3 points 7 months ago* (last edited 7 months ago)

I'd use something like:

= becomes

== equals

=== is identical to

It's funny how everyone thinks "equals" in this context should be "identical to" when, in normal language, it doesn't really mean that at all!

load more comments (22 replies)