DEV Community

loading...

JavaScript doesn't suck, stop telling me otherwise

aachh
Updated on ・9 min read

Attention: this is more of a lighthearted rant than an actual serious post. If you’re not into that kind of content you can safely leave, you won’t miss anything interesting. These are only my r/im14andthisisdeep opinions.


Man, if I were to choose one language that I think gets the most hate in the programming community, it wouldn’t be C++ nor Objective-C nor Java nor Visual Basic even. It would be JavaScript.

I’ve heard so many people (mostly lang-dev wannabes) saying stuff like „JavaScript is such a bad language,” „there are too many frameworks” „I mean, you can sum functions,” and my personal favourite that people also use when dissing other languages: „the only style of programming it encourages is bad programming.”
At least one of those claims is true. The binary operator + works in JavaScript even when both of the operands are functions. You can even subtract functions. You can add them to arrays and similarly subtract them too. Not-numbers are numbers, but also aren’t not numbers at the same time, and you can safely compare numbers to strings without any kind of framework (crazy, amirite?).
I mean, yeah. Those are all mediocre language implementation flaws, and it’s ridiculous they haven’t been fixed after 24 years, 24 years. [1]

But does that make JavaScript a language that sucks? Just think about that. Of course it doesn’t. JavaScript is in so much software by now that no one even remotely cares about the flaws I mentioned. And believe me, there’s a whole lot more of them. To dwell on them would be a waste of time, so nobody does. Everybody just learned to write code, good code at that, in it. Sure, it’s obvious that „more use cases or users means better technology” is wrong (looking at you, C++), but please read this post to the end if you already got here. Heck, I’ll lose a lot of developer clout because of this, but: I actually, genuinely like JavaScript, ES6 particularly. Probably even more than TypeScript, but that’s like saying I like plain old french fries more than tater tots with ketchup.

In this post I wanted to address common complaints and myths about JavaScript and try to respond to them and, well, basically tell you why you don’t have to care, shouldn’t care, and why you can with a clean conscience say JavaScript doesn’t suck and watch the angry replies on Twitter flood in your inbox. Please keep in mind this is a comedic rant and shouldn’t be taken as a bullet to anyone’s ego. If anyone’s ego, then mine. „Publicly putting my dumb opinions on the Internet for the world to see since 2020®.”

1: JS sucks because it was developed in the span of 10 days

This literally doesn’t mean anything. The existence of language jams itself (Repl.it language jam soon, hope to see you there) renders this argument meaningless. Yes, Brendan Eich couldn’t make the perfect scripting language for the web™ in less than two weeks, and yes, I’m not saying this is the work of lang-dev genius (Brendan Eich is kinda a genius doe), but this argument alone doesn’t prove anything. It doesn’t stand behind or against the language’s sake. It’s just a fun fact to bring up in random moments, like buying [typed!] tater tots with ketchup at McDonald’s.

2: JS sucks because the language design is bad

Language design quality is (partly) subjective. What I mean by this is the classic example of this old, archaic concept called opinions. What this generally meant back in the day was, I could like something, and another person wouldn’t have to. And they would go on to live together in harmony. Insane, right?
I mean, I admit this kind of sounds like I’m mocking you, which to be honest is what I’m doing, but yes, I like JavaScript because of its language design. I hate when projects get contributed to just because they’re made with some specific technology, or they get created with that technology so the creator gets Twitter fame. You don’t choose technologies based on how other developers will react, you choose the right tools for the job. If JavaScript is the right tool for the job, why shouldn’t you use it? Unless you don’t like it. That’s also an important factor, but I don’t want to overload this point.
If we’re talking about the language flaws, like the ones I mentioned, the situation is pretty simple: honestly how dumb do you need to be to actually make any of those mistakes in production? Either dumb enough to make them unironically or to still try to prove how JS is bad. Bang.

3: JS sucks because there are too many frameworks

This is the frameworks’ creators’ fault, not anyone closely related to the language itself. Stop blaming JS for something The League Of Extraordinarily React-Like Web Frameworks is responsible for.
Frankly though, for me the framework overload isn’t that bad. That’s like complaining how there are too many ice cream flavours at the ice cream store. Ice cream stores are made with the incentive of having a lot of flavours available. Going back to reality, I think framework choice is a matter of opinion as well. Take me, for example. If I’m making a web project, I’ll probably go with Preact for frontend, because rarely ever do I need all of React’s features, but I like React in general. Therefore we get two benefits at the cost of none: I get the ease of development, the client gets faster websites. But someone else might not agree with me cause maybe they don’t like reactive programming at all. Maybe they like Ember, or Elm, or A- Ang-… Angular. Well, everybody uses what they want to. The thing I mentioned earlier, ease of development, is such an overlooked factor when making projects. I think I’m intersecting with point 2 right now; people will go learning a framework for 3 months because it’s the hottest thing in the community right now [2] instead of something they know they’d finish the project with in 3 days.
Choose your framework wisely. Don’t diss JavaScript because you can’t.

4: JS sucks because TS exists

Not gonna lie, TypeScript is like the Jesus of Node-aware development right now. So many people use it and they’re just so, so ecstatically happy with it. I used it in a couple of projects. And what do I think?
It’s okay. It definitely makes managing bigger projects a lot easier, sometimes when I go back to JavaScript it even feels weird when you can’t define or specify a type. Other than that, it’s not very different from ES6.
That being said, I think people often use TypeScript because „it’s a good practice” to do so. A relatively big amount of the time writing as many types as TS requires you to is overkill, so when I want a project where I know I will be better off without types and won’t make many typing mistakes, I go with my old buddy JavaScript. Simply because it makes more sense to use it.

5: JS sucks because very many people complain about it

Unless the complaining entity is looked up to by many people, this doesn’t mean very much on its own either. What do I mean by that though?
Take Twitter. The incubator of new developers and harbour of veterans. If a popular and / or respected company / organization tweets something, chances are most developers will see it. That’s why it’s important what they write there. Remember when Discord linked to a Medium article on Twitter about how they’re transitioning to Rust from Go? It must have hurt at least some Go groupies (and probably convert, or at least introduce a small number of them to the Rustacean side). Now, Go is a totally very legit and good technology, I’m not trying to shame it or its users right now. But note that Discord did transition. By default, if something is good enough, transitioning is overkill as well, so when it actually happens, it should tell you „damn. Maybe Rust is as good as they say.”
I know I’m sounding weird, but what I’m trying to get across is, unless you have something like +300 followers on Twitter, your opinion probably doesn’t matter. Sorry, it’s not personal. I know my opinion doesn’t matter either. [3] You can always switch to another technology yourself, nobody is going to stop you. But the thing is, unless someone (or something) popular disses something in the open, chances are if it’s popular already, it won’t lose fame. If it works, why bother switching to something different?

6: JS sucks because WebAssembly exists and it’s going to take over soon

I don’t think so. As far as I know, WebAssembly isn’t aiming to be a replacement for JS. Note how the two of them have two completely different use cases. You use JS for everything, and you use WebAssembly if you’re a #BoldDeveloper.
Distaste[r]ful jokes aside, the existence of WASM doesn’t really impact the JS world. The two really have different use cases. WASM is designed for those times when you need to perform something heavy in the browser, like a 3D game or some kind of RAM-consuming data visualisation. JS still remains the standard for most things to do around in webdev, and unless some really, really game-changing, perfect language / technology comes along, we’re stuck with it. All in all, everything is JS, whether you like it or not. TypeScript, CoffeeScript, Elm, Reason, Scratch even, everything is JS. All these technologies are just bridges in case you don’t like the real deal.
Even with backend, we’ve become so lazy that we use Node just because it’s the same language as the one we use for frontend. Pretty much nothing stops you from using Actix, Woo or Cowboy (all of which are awesome projects, be sure to check them out!).

7: Bjarne Stroustrup said that „there are only languages that nobody uses and that are complained about all the time.” Does that make JS a good language?

No, I generally don’t agree with this quote. I feel like it’s trying to justify C++’s flaws and trust me when I say it does have a lot of them. The quote may have worked 10, 20 years ago, when people still liked C++, and you could choose either C++ or, like, Assembly for your next big project, but it doesn’t apply anymore. There are tons more technologies nowadays that people use all the time and are just scared to even say a bad thing about them, examples include Elixir + Phoenix, Rust, SwiftUI, Yarn, and others. I’ve literally never heard any single complaint about any of those technologies, and they’re all pretty incredible. [4] So, no. JS is both used a lot of the time and it gets tons of complaints every day, but it doesn’t make it neither a good or a bad language.

Conclusion

Anyway, I get the fact that you may not like JS. It’s a normal thing, I’m not a fan of a lot of languages people normally like. I just don’t want people to hate on JS in an NPC Wojak manner because „JS sux hahaha”
Thanks for reading this rant. I hope it was funny, interesting, informative, or at least one of those.


[1] → Come on. JS wouldn’t have the same m o o d without the derpy stuff though.
[2] → I don’t mean trying out new frameworks is bad, I mean not thinking about picking out the right tools for the important jobs is bad.
[3] → That’s why I’m still fascinated by the fact you’re reading this. Thank you very much. Remember to unleash hell upon me in the comments.
[4] → I myself like the idea of Elixir, but Phoenix is an MVC framework and I just don’t get MVC. I don’t know if it’s because I’m dumb, or if anyone hasn’t explained it well enough for me to understand it, but I just don’t like getting +50 files right off the bat at the initialisation, initialisation of a project. It’s just too much and it discourages me to use the framework. People have been making such amazing things with it though that I simply can’t say it’s bad. I’m just dumb.

Discussion (1)

Collapse
lud profile image
Ludovic Sforza • Edited

Phoenix is more like Express, where middlewares are called plugs. On top of that there is a great integration with Ecto (ORM-like) and the template engine EEx, but both are totally optional. Check out the docs to get you started without all the boilerplate and a minimum amount of files :) Or you can ask me!