this post was submitted on 14 Mar 2024
1283 points (98.5% liked)

Programmer Humor

19623 readers
2719 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
 
you are viewing a single comment's thread
view the rest of the comments
[–] _cnt0@sh.itjust.works 10 points 8 months ago* (last edited 8 months ago) (3 children)

I just dabbled in javascript again, and that description is spot on!

console.log('javascript operators are b' + 'a' + + 'a' + 'a');

[–] sjmarf@sh.itjust.works 10 points 8 months ago (1 children)
[–] hypnicjerk@lemmy.world 6 points 8 months ago (1 children)
[–] fishbone@lemmy.world 3 points 8 months ago

Pepperoni and green peppers, mushrooms, olives, chives!

Oh wait wrong song.

[–] arc@lemm.ee 9 points 8 months ago* (last edited 8 months ago)

The only reason people use JS is because it's the defacto language of browsers. As a language it's dogshit filled with all kinds of unpleasant traps.

Here is a fun one I discovered the other day:

new Date('2022-10-9').toUTCString() === 'Sat, 08 Oct 2022 23:00:00 GMT'
new Date('2022-10-09').toUTCString() === 'Sun, 09 Oct 2022 00:00:00 GMT'

So padding a day of the month with a 0 or not changes the result by 1 hour. Every browser does the same so I assume this is a legacy thing. It's supposed to be padded but any sane language would throw an exception if it was malformed. Not JavaScript.

[–] krippix@feddit.de 3 points 8 months ago (1 children)

I can‘t believe you’ve done this

[–] _cnt0@sh.itjust.works 1 points 8 months ago

Well, not by accident.