this post was submitted on 07 Sep 2023
54 points (100.0% liked)

Programmer Humor

19386 readers
354 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
 
top 12 comments
sorted by: hot top controversial new old
[–] AbsolutelyNotCats@lemdro.id 3 points 1 year ago* (last edited 1 year ago) (1 children)

Just a reminder that JavaScript was developed in 10 days, the same amount of time i spend fixing bugs when i just miss a ","

[–] SnipingNinja@slrpnk.net 1 points 1 year ago* (last edited 1 year ago) (1 children)

The world was made in 7 days, so it should have been 3 days left to develop js

[–] AbsolutelyNotCats@lemdro.id 0 points 1 year ago (1 children)

This sounds more credible than the big bang theory. I no longer believe in science

[–] dukk@programming.dev 2 points 1 year ago

Physics was written in JavaScript?

…checks out.

[–] devious@lemmy.world 1 points 1 year ago (1 children)

This is one of the most educational and entertaining reads on the internet, if you are into that kind of thing:

https://github.com/denysdovhan/wtfjs

[–] rikudou@lemmings.world -1 points 1 year ago (1 children)

Has anyone actually read through that? Reading the first few examples and it's just not understanding how languages work half of the time:

!!"false" == !!"true"; // -> true
!!"false" === !!"true"; // -> true

Wow, no shit, non-empty string coerces to true, who would've guessed! Did you know that !!"bullshit" === !!"true" as well? Mind=blown.

NaN === NaN; // -> false

Again, no shit, that's in the NaN specification and the page even mentions it, so why even include it?

[–] noli@programming.dev 2 points 1 year ago (2 children)

Which is why I'm of the opinion that dynamically typed languages are evil. !!"false" should either be caught at compile time or raise an exception.

I'm thoroughly convinced that the only use of dynamically typed languages is to introduce bugs

[–] Camilo@discuss.tchncs.de 2 points 1 year ago

I am with you. To me these are non-obvious details, just a bug waiting to silently happen in production.

[–] rikudou@lemmings.world -1 points 1 year ago

Why? IMO that's perfectly valid. The various type coercions are sometimes crazy, but IMO the rule that non-empty string is coerced to true and empty string to false is very simple to follow. The snippet is not even a gotcha, I don't see anything worth failing over. Putting "true" or "false" in a string doesn't change that.

[–] DanielCF@discuss.tchncs.de 1 points 1 year ago

You just have to look at the problem from a different angle.

[–] nxfsi@lemmy.world 1 points 1 year ago

The tech equivalent of inventing leaded gasoline.

[–] tun@lemm.ee 1 points 1 year ago

Approach the problem from different angle!