Hacker News new | ask | show | jobs
by SoylentOrange 2307 days ago
The article conflates “popular” with “loved”. JS is popular because it’s the only* language in which it’s possible to write browser apps and extensions. The number of people using transpilers for this purpose is minimal.

In actual fact, most people try to avoid JS whenever possible, instead using TS or other languages that compile down to JS.

Saying people love JavaScript because it’s the most popular is like saying people love McDonald’s because it sells the most burgers

[*] since we don’t have Java applets or Flash apps anymore. Writing in other languages still means transpiling to JS in the end

5 comments

> In actual fact, most people try to avoid JS whenever possible

Eh... if this was actually true, the web would look very different. I just can't square "web programmers hate Javascript" with "web programmers are obsessed with SPAs/CSS-in-JS/NodeJS backends/etc..."

> Writing in other languages still means transpiling to JS in the end

I'm assuming you already know about WASM, but if you don't, the future is starting to look relatively optimistic for other languages on the web. Still some problems to solve, but C++/Rust already have pretty promising toolchains working today.

Transpiling sucks. It breaks debugging. The JavaScript community tolerates it but you can bet everyone who can avoid it will do so. We’re in the transpilation age, which does, as you indicate, provide an “in” for other languages.

But for me, JavaScript is not about having your dinner made just how you like it. It’s about targeting the lowest common denominator and keeping your code simple because of that.

I think that’s where JavaScript is headed in the limit. We’re at the low point for “just put a file in the browser, it’ll work!” But I guarantee you that style will come back in the next wave. You already see people going that way today. Casting off Babel and using much simpler packaging tools with code that’s natively readable in the most common browsers.

Would you package Rust for the JVM? Maybe. But it would not be fun.

> is like saying people love McDonald’s because it sells the most burgers

Ok I give up, why is this wrong?

The 101 is the busiest freeway in the Valley, but I doubt many people love it...
Sure, but there's not 20 equally filling and cheap freeways within walking distance of the 101
Meanwhile, you can use any language on the server yet many of us including myself use Javascript. I'd say modern Javascript is easily one of the best languages.
Most server side code is Java, quickly followed by PHP.

And of course next to JS, you have C#, Asp.Net, Ruby, Python, and Go.

I'd say that given that:

- a lot of people only know JS (like designers)

- JS has a monopoly on the front end and is the only language that can be used on the front and back

- JS has existed for as long as Java (C#, Ruby and Go are way younger)

- there are JS materials everywhere given the web popularity

- the web is the most popular plateform in the world

The fact, as a freelancer going from company to company, I see so little JS on the server compared to other languages tells a lot.

JS is used on the server because there are tons of JS developers thanks to it being basically the only language used on the frontend.
> Saying people love JavaScript because it’s the most popular

I’m sure it gets a lot of hate just because of its dominance.