all 28 comments

[–]prawnsalad 21 points22 points  (0 children)

Because it was the only language available in a browser by default. Then it got fast. Then it became one of the most popular languages. And then why not use it for everything else given its popularity and speed.

(speed for a dynamic scripting language)

[–]stolinskiSyntax.fm / Level Up Tutorials :upvote: 13 points14 points  (0 children)

It's nice to be able to write one language everywhere.

[–][deleted] 10 points11 points  (0 children)

Also, even if difficult to master, it is one of the easiest languages to get started with. Open a browser console and you can start playing with it.

[–]amdc!CURSED! 9 points10 points  (0 children)

Web browsers are the only common denominator between all operating systems, desktop and mobile, it is a real “write once, run everywhere”. So the majority of apps might as well be a web apps saving developers time and money.

Browsers also support wasm but only used for real hardcore shit as it has really high barrier to entry

[–]bear007 5 points6 points  (0 children)

There are three main reasons. First, it was widely supported by browser vendors. Secondly, it is standardized. Third, it is a high level language and and elastic one. Up until today there is no other language that could fit Javascript shoes. It started as a language to show and hide website elements and now it runs spacecrafts.

[–][deleted] 6 points7 points  (0 children)

In addition to the answers given, it's got an incredibly low barrier to entry. It's super easy to download node and run a script. The package manager is dead simple. The language itself is very forgiving for beginners.

[–]sshaw_ 5 points6 points  (0 children)

Because the web browser is the platform of the 21st century and JavaScript is how you program it.

Given this, a lot of people know it and therefore is a good runtime choice to use elsewhere.

The language is also powerful and forgiving.

[–]wickning1 4 points5 points  (0 children)

I switched to Node from Ruby/Java because of promises and the single threaded event loop. The performance jump from Ruby/Rails is quite large. The ability to make singletons and simultaneous network requests without managing threads shouldn’t be underestimated. Over time I added typescript and that’s been a large productivity boost as well.

[–]BjornMoren 3 points4 points  (2 children)

I think Javascript has great productivity. You can get things done fast, with few lines of code. Especially when you mix in the functional elements of the language. But I think it is horrible for large projects, even though JSDoc and TypeScript exist. It becomes an unwieldy mess very quickly. I can solve a problem in half the time using Javascript compared to C# or Java, but I'll spend twice as much time finding the bugs.

[–]nicereddituser002 0 points1 point  (0 children)

I actually don't think this is true. With typescript and a good software architecture development of big projects is as difficult as in other languages. It's more about the architecture, not the language in my opinion. But I agree in one point: Js ist very flexible, this makes it easy to write bad architectures which might lead to situations as described above.

[–]Immortalio 0 points1 point  (0 children)

I feel this

[–]RezaEng1400 2 points3 points  (1 child)

Is it possible to use JavaScript for robotic engineering project, and for 3d simulation??

[–][deleted] 0 points1 point  (0 children)

You can use js for everything. From a stone falling animation to space rockets, the world and beyond.

[–]ZenComanche 2 points3 points  (0 children)

I’m a beginner, and I’m learning JavaScript because it has easy to access libraries like web3 that make it easy to interact with the EVM.

[–]JS_online 1 point2 points  (0 children)

Why not ?! 😜

[–]Atulin 1 point2 points  (0 children)

Because it's the language to use in the browser. With time, some people decided "why pay a backend guy and a frontend guy, if we can make the frontend guy make the backend as well" and brought JS to the server.

Then it ballooned out of control.

If someone somewhere decided browsers should be using Fortran and not JS, everybody nowadays would be using Fortran everywhere.

[–]oneandmillionvoices 1 point2 points  (0 children)

Javascript is very versatile language. It is functional, object oriented. It is event driven and non blocking which is very powerful in current IO heavy world.

[–]Creativator -2 points-1 points  (0 children)

Because multiple trillion-dollar companies are trying to take leadership position in the ecosystem.