this post was submitted on 04 Jun 2025
1032 points (98.6% liked)

Programmer Humor

24834 readers
836 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] bitjunkie@lemmy.world 2 points 1 month ago* (last edited 1 month ago) (5 children)

It's because + is two different operators and overloads based on the type to the left, while - is only a numeric operator and coerces left and right operands to numeric. But frankly if you're still using + for math or string concatenation in 2025, you're doing it wrong.

[–] Hadriscus@lemm.ee 8 points 1 month ago (4 children)

I know nothing about javascript, what is wrong with using + for math? perhaps naively, I'd say it looks suited for the job

[–] __Lost__@lemmy.dbzer0.com 15 points 1 month ago (1 children)

The correct way to do it is to load a 500mb library that has an add function in it.

[–] bitjunkie@lemmy.world 0 points 1 month ago* (last edited 1 month ago)

Point taken but the one I use is only ~200k for the whole package, ~11k for the actual file that gets loaded

load more comments (2 replies)
load more comments (2 replies)