|
|
|
|
|
by tolgerias
1692 days ago
|
|
Functions are first class. Async i/o by default. Familiar syntax (I'm sure Haskell or Clojure are better languages, but they sure take some time to get used to. You can be fairly productive in js in very little time). There are packages for anything you can think of, no need to reinvent the wheel most of the times.
And I even like it's single threaded nature. Being able to keep a process waiting without needing to spin a new thread with all that implies is very convenient.
Edit: Original commenter had already mentioned typescript. So what's the deal with TS? I think on top of adding much needed type safety to Javascript, TS is also one of the best type systems you can ask for. |
|
> Functions are first class.
Always a good thing to have in a language but I struggle to think of a language that doesn't have this now. Java has it, C#, Python… if a language is being developed and didn't have it then now it does, right? Perhaps C doesn't - I checked, functions may be passed as arguments but does not allw nested functions, but it has callbacks so a type of closure is possible… hard to tell. Still, I'd say not using C was an advantage!:)
> Async i/o by default
I'm not sure which languages this gives an advantage over?
> Familiar syntax
I don't think this is an advantage, most languages are much of a muchness, and there are some serious footguns that still lay around in JS. Is `==` familiar? No, that's a footgun. Automatic semicolon insertion (ASI) rules? No, they're another footgun. Are fat arrow operators familiar? Doubtful. The new backticks? They're the other way round to what I'm used to.
Certainly though, it can be picked up quickly enough.
> There are packages for anything you can think of
This is definitely an advantage over some newer languages, but over those in major use, it's not. Still, the way packages are installed and handled is… eye-opening. That wheel has been reinvented several times, and it still looks wonky.
> I even like it's single threaded nature
Sometimes that's a good thing, true, but it's not an advantage to have it set that way all the time.
> TS is also one of the best type systems you can ask for
I haven't used it, tbh, but I would say that an optional type system (it's optional in that you don't have to use TS, I don't know if it's optional once you start using TS, that would be better) is a definite advantage over some languages. It's not baked in though so that's half a point.
I just don't see it. I think the driving force of the move to Javascript everywhere was because devs were tired of learning at least three languages (JS, something, SQL) and not being very good in all three (usually poor at SQL) and thinking they'd get more control by kicking out the DB guy who'd stop their bad ideas (because they didn't know SQL) and they could become an expert in one language to rule them all. Companies love it because of fungibility and more new devs tend to start with Javascript than anything else.
Perhaps I've just got used to keeping several languages in my head?