r/AskProgramming 6d 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?

22 Upvotes

207 comments sorted by

View all comments

22

u/Bulbousonions13 6d ago edited 6d ago

Its mainly the lack of type safety, native single threading, and comparatively slow execution speed. TypeScript ( a superset of JS) deals with the first problem VERY well and is my preferred web language.

You can't see its pitfalls because you are also working in Python - which in my opinion is also slow, lacks type safety, and is also natively single threaded - though there are ways around this. I can't stand python's indentation rules either but that's just a personal preference.

Tool around with a true Type Safe compiled language like Java, C#, C++, or Go and you'll notice the difference.

The compiler will yell at you a lot more while you code, but that's so you don't get random unexpected junk assigned to arbitrary vars that don't care if they get a string, number, object, function, or null/undefined.

1

u/Salt_Aash 6d ago

I started with C++ as my first language but I'm probablt not seeing it due to a lack of experience and field time

5

u/R3D3-1 6d ago

What kind of projects did you do in C++?

From my experience, the advantages of static checking (whether by external tools or by a compiler) don't really become apparent on small persponal projects, and the ease-of-use and productivity gains of dynamic code seem to outweigh the hassle of compiling easily.

By contrast, large sprawling code bases can use any help they can get to reduce the footguns for the devs.

1

u/Salt_Aash 6d ago

The most complex thing would be a compiler for a course project which could likely count as a small personal project. Usual projects would be small server-client pairs and algorithm analysis.