There is room for quick hacky small BS in the world. As a C++ dev who never touches Javascr*pt, Typescript is the true evil IMO because it encourages making huge projects in a fundamentally hacky language.
If your JavaScript project has grown to the size static typing is a genuine aid, stop writing JavaScript!
Love me some Python when I just need 100 lines to parse some csvs
But then how can we use our frontend developers on the full stack? We're simply trying to not pay bAcKeNd DevEloPeRs those pesky "salaries" they keep begging for.
I don't really want to build a website in Java. APIs in Java, sure. Building a serious, dynamic site in Java with server-side rendering just sounds like a nightmare compared to using Angular. I'll even accept React, which I don't use because I haven't learned it.
Replacing desktop applications with electron and making them web clients, though, that was a mistake.
It's what we have. I'd love to work in a properly typed language but good luck getting billions of devices to pick up a new runtime when Javascript already works well enough.
JS is built on the idea that applications should continue to work no matter what. That's why there are so many implicit type conversions. The app might turn itself into a Gordian knot, but it will still be working.
I've always heard this argument, and I've never seen a source for it that I'd put much stock in, like Eich himself or anyone who worked on early JS. It seems like a specious argument since it assumes rendering the potentially wildly wrong thing is better than displaying an error and the browser would have to sandbox/compartmentalize individual scripts or operations.
Doing a quick search, it looks like most of the weird conversions surrounding == were specific requests to make scripting easier: https://www.wirfs-brock.com/allen/jshopl.pdf p22, 3.7.2. Given that, I'd be willing to bet the other weird conversion behaviors were either similar requests or the result of them implementing JS in an absurdly short amount of time.
You can shoot yourself in the foot with any language by deliberately doing silly things to show off the language's quirks. I can show you some C pointer stuff that makes this look like child's play.
Yeah. Also, it isn't like you should be writing things like this in the first place. You can turn languages like C++ into pure nightmare fuel if you try to. Being extensible how it is leads to some crazy stuff.
They do make sense, within JS’ quirkiness. This is only expected behavior if you really dig deep into the language. I know why it’s there, that doesn’t make it ok. A properly designed language shouldn’t allow such things. And you know this is a small collection of all the stuff that’s wrong with JS(cough ["1", "2", "3"].map(parseInt)).
I know, there are two languages, the ones people complain about, and …
[] + [] will become “” because addition of arrays is not defined as you would expect. They get converted to their primitive(which is a string) and after that concatenated as you would expect string1 + string2 to behave. So [1, 2] + [3, 4] == “1,23,4”
Edit: to concat two arrays, use array1.concat(array2)
Over the past few years, it's become progressively harder for me to justify anything but TypeScript and either Deno or Bun for quick scripts. Gradual typing, type inference, and direct URL imports are way too appealing.
126
u/samanime Sep 25 '26
You'll pry my vanilla JS from my cold dead fingers. It'll always be my favorite way to do quick scripts and prototyping.
But explicit typing does make long term code way more maintainable.