Easy to reason about, great performance for most cases, simple to debug and write code for, a plethora of libraries, easy to ship, no need to have different teams for backend/frontend, and minimal tooling needed.
GP comment was presented somewhat snarkily, but I'm not sure they're all that wrong.
You don't think JS is obviously unique for its ubiquitous Promise, async/await, + async-everything abstraction. You tend to only get that in other languages (Rust, Python, Ruby) by limiting yourself to a fraction of the ecosystem.
Btw, what's lazy is making convenient uncharitable assumptions about others than just... asking.
This forum is full of people who could tell you why they still use JS after they analyze pros/cons of other languages.
> You don't think JS is obviously unique for its ubiquitous Promise, async/await, + async-everything abstraction. You tend to only get that in other languages (Rust, Python, Ruby) by limiting yourself to a fraction of the ecosystem.
A fraction like nodejs or whatever subset of NPM you decide to use?
Core JS is what you get in a browser. That includes async/await, but it's hardly ubiquitous in usage in the core.
The main distinction JS has over Perl, Python, Ruby etc is that it's in the browser, so you can assume almost everyone has it and it's accessible in some manner if they access a web property you are responsible for.
You are here because you are interested and want to learn. You probably know more than 1 language.
But that is not the general developer. Most developers are lazy and at the end of the day, want to go back to their wife and kids ( for example).
But I have yet to find a language that has the same set of features except JS. If you want to offer up an alternative, please do so.
There is not a single feature in JS you can't find elsewhere, often better implemented.
If anything, the vast majority of scripting languages (Python, Ruby, PHP...) have more features than JS.
JS is so lacking in features that half of its ecosystem is dedicated to compensate for that (typescript, babel, webpack, undersacore...).
I'd like to know what language you use as a baseline for this?
I made my first "real" Javascript code back in 2005 (a vector map system that worked in realtime) and I've been working mostly with frontend for the last 3 years so it is not lack of familiarity. In between that however I have programmed a lot of other languages, worked in a number of different teams, written new code, maintained old code and generally gotten some perspective on life.
That perspective has sent Javascript down my list of languages that are easy to reason about.
The lack of OO means no typecasting, inheritance models, interfaces, etc.
Arrays are fully dynamic, not type restricted and operate strictly by reference.
No memory mapping, manual garbage collection or even GC adjustments.
Suddenly the list of things someone has to understand to be a competent JS engineer is way smaller than a language like C or Java.
There are other languages that have a similar level of being easy to understand such as Python and Ruby, and they're good languages too but have a different set of tradeoffs.
Here's my attempt to create something similar from my perspective:
- Being able to know to at any point what a variable can contain is very liberating. (Ok, you can define a list of Object that behaves just like a list in JS: "fully dynamic, not type restricted", but thankfully for people like me that is not common in Java anymore.)
- Knowing that the compiler has my back allows me to work faster.
- My preferred languages (Java, C#, TypeScript) together with version control allows me to refactor fearlessly.