1012
JavaScript (lemmy.ml)
you are viewing a single comment's thread
view the rest of the comments
[-] calavera@lemmy.zip 10 points 1 month ago
[-] qaz@lemmy.world 28 points 1 month ago
[-] mapleseedfall@lemmy.world 6 points 1 month ago

This here is my absolute favorits way to diss someone. Send the a wikipeda link and bam!

[-] zzx@lemmy.world 8 points 1 month ago
[-] PieMePlenty@lemmy.world 3 points 1 month ago

It does to some degree.

  • "11" is string, 1 is an int, because strings can be added (+) convert int to string and combine: "11"+"1" = "111"
  • "11" is string, 1 is an int, because strings cant be subtracted (-) convert string to int and combine: 11-1 = 10

I'm not into JS so I don't know how it takes priority. ints can be added too, so I guess its basing it on the first variable which is compatible with the operator: in the first case string, in the second case int.

If this is how it works, it makes sense. But imo its a case of the designers being preoccupied with whether or not they could, they didn't stop to think if they should.

this post was submitted on 04 Jun 2025
1012 points (100.0% liked)

Programmer Humor

25457 readers
953 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 2 years ago
MODERATORS