49 points
*

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

permalink
report
reply
19 points
*

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

permalink
report
parent
reply
9 points

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

permalink
report
parent
reply
9 points

Physics was written in JavaScript?

…checks out.

permalink
report
parent
reply
45 points

The tech equivalent of inventing leaded gasoline.

permalink
report
reply
40 points

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

permalink
report
reply
32 points

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?

permalink
report
parent
reply
23 points

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

permalink
report
parent
reply
8 points

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

permalink
report
parent
reply
4 points

Dynamically typed doesn’t imply it’s monotyped. And monotyped languages can work just fine, you just have to not hide different operations under the same symbols just differing by type like JS does.

The entire problem with JS is that it both is monotyped and it isn’t.

permalink
report
parent
reply
1 point

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.

permalink
report
parent
reply
5 points

NaN===NaN is the fault of the floating point standard tho i believe.

permalink
report
parent
reply
6 points

Yes, that’s my point.

permalink
report
parent
reply
1 point

Also, a huge proportion of the list is just not understanding IEEE floats behaviour and blaming the language for it. Exactly like this post is doing. All those weird number things js does is because it only uses floats for everything and every language that uses floats will behave the exact same way.

permalink
report
parent
reply
1 point

So, uh, first example, the developer decided instead of comparing based on type, he rather converts the values? Why?!

permalink
report
parent
reply
24 points

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

permalink
report
reply
24 points

Ah. The shork did the math. This explains a lot.

permalink
report
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 7.2K

    Monthly active users

  • 955

    Posts

  • 37K

    Comments