this post was submitted on 07 Sep 2023
948 points (98.9% liked)

Programmer Humor

25484 readers
1750 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
[–] devious@lemmy.world 35 points 2 years ago (13 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 29 points 2 years ago (11 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 22 points 2 years ago (9 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 7 points 2 years ago

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

load more comments (8 replies)
load more comments (9 replies)
load more comments (10 replies)