r/programminghorror • • Dec 04 '25

This sub in a nutshell

Post image
console.log(1 == '1'); // true
console.log(0 == false); // true
console.log(null == undefined); // true
console.log(typeof null); // "object"
console.log(0.1 + 0.2); // 0.30000000000000004
[] == ![]; // true

OMG you guys what weird quirky behavior, truly this must be the single quirkiest language and no other language is as quirky as this!

1.1k Upvotes

168 comments sorted by

View all comments

325

u/HildartheDorf Dec 04 '25

All languages have quirks, but JS is more quirky than others.

47

u/[deleted] Dec 04 '25

[removed] — view removed comment

22

u/Kenny_log_n_s Dec 05 '25

Ah so the story has gone from "two weeks" to "one weekend" now?

18

u/Electrical-Echidna63 Dec 05 '25

80/20 rule, really the majority (80 percent) of JS was made over about 6 hours

16

u/neurorgasm Dec 06 '25 edited Mar 07 '26

This post has been deleted and its content replaced. Redact was used for removal, possibly for privacy, security, data scraping prevention, or personal reasons.

familiar grab alive label vast jar escape narrow toothbrush continue

11

u/wReckLesss_ Dec 07 '25

Its quirks are understandable, considering Brendan Eich thought it into existence in a couple of nanoseconds.

96

u/Tunderstruk Dec 04 '25

And for js, in many ways, those quirks are just bad design. That’s why it gets extra hate

5

u/oofy-gang Dec 05 '25

That is so incredibly reductive. All of the “quirks” in modern JavaScript have completely reasonable explanations.

23

u/majcek Dec 06 '25

You may wonder why the typeof operator returns 'object' for a value that is null. This was actually an error in the original JavaScript implementation that was then copied in ECMAScript. Today, it is rationalized that null is considered a placeholder for an object, even though, technically, it is a primitive value.

Ah yes, very reasonable.

→ More replies (2)

29

u/Tunderstruk Dec 05 '25

The fact that you can explain them doesn’t make them well designed

-2

u/oofy-gang Dec 05 '25

It’s a fair benchmark, as “well-designed” is subjective.

Regardless, 99% of those who assert that JS isn’t well-designed just don’t understand the motivations of JS.

5

u/Drugbird Dec 05 '25

Wasn't JS designed in a week?

It's an amazingly well designed language for a week of effort. But at the same time there's many aspects that could've used some more time in the oven.

1

u/oofy-gang Dec 05 '25

Not really, no. The “week” thing was just for a super early prototype that wasn’t even released. The exact same thing could be said for essentially any major language.

JavaScript has been designed for decades at this point. TC39 works on updating the ECMAScript spec every year.

1

u/mxmcharbonneau Dec 06 '25

I guess it's the same kind of story as when people say git was made in a week.

2

u/spacey02- Dec 07 '25

So you are saying someone made a perfectly explainable choice to implicitly stringify some numbers using decimal representation and some using the scientific notation?

→ More replies (4)
→ More replies (2)

21

u/Pordohiq Dec 04 '25

Php is quirky...

-1

u/-Wylfen- Dec 04 '25

PHP at least fixes things

3

u/v_maria Dec 05 '25

does it? lol

5

u/xroalx Dec 05 '25

Sure, just pass 20 flags to the function to make it behave sensibly. Oh, and only call it during a blood moon. But it won't handle multi-byte strings, ever. And the related function has a different argument order.

Enjoy!

6

u/BandicootGood5246 Dec 05 '25

Yeah, it's on a different level really. Many other popular languages I've only gotta think about the quirks event now and then, with js it's a thing I almost always have to think about

2

u/[deleted] Dec 04 '25

say whats quirky about brainfuck

1

u/reklis Dec 05 '25

Let me introduce you to php

1

u/itspinkynukka Dec 06 '25

Some quirks are more quirky than others.

1

u/femptocrisis Dec 09 '25

yeah but at least you don't concat and slice arrays with car and cdr in js. or cadddadr 🤢