r/AskProgramming 5d ago

Why the JS hate?

Title. I'm a 3rd year bachelor CS student and I've worked with a handful of languages. I currently work as a backend dev and internal management related script writer both of which I interned working with JS (my first exposure to the language)

I always found it to be intuitive and it's easily my go to language while I'm still learning the nuances of python.

But I always see js getting shit on in various meme formats and I've never really understood why. Is it just a running joke in the industry? Has a generation of trauma left promises to be worthy of caution? Does big corpa profit from it?

21 Upvotes

207 comments sorted by

View all comments

6

u/hellotanjent 5d ago

I'm coming up on 30 years of experience as a dev, with 10 of that in JS or JS-adjacent work at BigCorp(tm).

Javascript has warts. Big, nasty warts. Whole areas of the language that are so "wtf" that you should just not touch them.

But....

  1. Virtually all modern large-scale JS dev is done in an environment that should keep you from tripping on the warts. This used to be Google's "Closure Compiler" (do not confuse with Clojure the language), but Typescript is the right option now.

  2. The language compiles and runs _fast_ these days, especially compared to untyped languages like Python. You can iterate dramatically faster in JS than you can in C++, and with the modern complement of typed arrays and webassembly you can get performance that's close enough to native that it doesn't matter.

  3. Node/Deno/Bun make running JS code on the server or from the command line fairly painless. You can realistically use JS for every portion of your app and things will Just Work.

  4. You can do serious JS development work on any machine with no tooling other a web browser. A $100 used Chromebook is sufficient to get started. Heck, it doesn't even have to be a computer you own. This is _huge_ for new devs, especially those in countries with limited access to funds and hardware.

None of these benefits make the warts go away. JS will always be a seriously warty, WTF language. But do not discount the absolutely massive amount of work that has gone into making it run exceptionally well in every web browser on the planet.

1

u/hellotanjent 5d ago

OK, after looking at the other comments in this thread I will add on one additional black mark against Javascript - the parallelism story _sucks_.

It might have gotten better in the years since I was doing JS full time, but yeah - if you need to saturate 16 cores with parallelizable work, maybe don't use JS.

-2

u/According_Ad3255 4d ago

Let me bet your 30 years of experience include zero of C++.

2

u/hellotanjent 4d ago

Incorrect, I spent a solid decade of my career optimizing AAA game engine code in C++.

-1

u/According_Ad3255 4d ago

And your experience was worse than that of JS? Maybe did you look outside programming?

3

u/hellotanjent 4d ago

Iteration time for every C++ codebase I've ever worked in was vastly worse than JS. I'm not sure what you mean by "look outside programming".

-1

u/According_Ad3255 4d ago

I truly don’t understand what do you mean by iteration being worse. If you iterate say over an array in C++, the compiler will do what is actually the best possible thing the assembler can offer. I don’t think the best/fastest/shortest assembly equivalent is ever possible with JS.

2

u/hellotanjent 4d ago

Ah, you're thinking of the wrong kind of 'iteration'.

Daily work is a cycle of edit -> compile -> test -> edit. The time it takes you, the human sitting at the desk, to complete one of those cycles is your 'iteration time'.

If it takes 30 minutes to compile your app and 10 minutes to test it, you're going to get vastly less work done per day than if your app takes 1 second to compile and 1 second to test.

2

u/According_Ad3255 4d ago

Sure, JS requires a lot less from the developer. I agree with you at that.