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

Programmer Humor

24391 readers
364 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
[–] palordrolap@fedia.io 19 points 2 weeks ago (6 children)

it commutes

Maybe the behaviour with regard to type conversion, but not for the operation itself.

"13"+12 and 12+"13" don't yield the same result.

[–] raspberriesareyummy@lemmy.world 7 points 2 weeks ago (5 children)

Nor would I expect "1312" to equal "1213".. Still that operator with these operands should just throw an exception

[–] palordrolap@fedia.io 4 points 2 weeks ago (4 children)

Given it's JavaScript, which was expressly designed to carry on regardless, I could see an argument for it returning NaN, (or silently doing what Perl does, like I mention in a different comment) but then there'd have to be an entirely different way of concatenating strings.

expressly designed to carry on regardless

I'm surprised they didn't borrow On Error Resume Next from Visual Basic. Which was wrongly considered to be the worst thing in Visual Basic - when the real worst thing was On Error Resume. On Error Resume Next at least moved on to the next line of code when an error occurred; On Error Resume just executed the error-generating line again ... and again ... and again ... and again ...

load more comments (3 replies)
load more comments (3 replies)
load more comments (3 replies)