选题[tech]: 20201102 4 reasons why JavaScript is so popular

sources/tech/20201102 4 reasons why JavaScript is so popular.md
This commit is contained in:
DarkSun 2020-11-03 05:04:42 +08:00
parent e3989f8dbf
commit 6cec5c6556

View File

@ -0,0 +1,121 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 reasons why JavaScript is so popular)
[#]: via: (https://opensource.com/article/20/11/javascript-popular)
[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha)
4 reasons why JavaScript is so popular
======
There are good reasons why JavaScript is consistently among the top
programming languages.
![JavaScript in Vim][1]
As this chart from GitHub's _[State of the Octoverse][2]_ report shows, [JavaScript][3] has consistently been most popular programming language based on the number of contributors to projects on GitHub.
![Top Languages from The State of the Octoverse report][4]
Top languages, per The State of the Octoverse (© 2019, [GitHub Corp][2])
In the [previous article][5] in this series, I dove into the history of JavaScript. In this article, I'll share four of [the reasons][6] it is so popular.
### 1\. JavaScript caters to beginner, intermediate, and advanced developers
JavaScript does not need any environment setup; just open a browser, like Chrome, navigate to [Developer Tools][7], and start coding. Writing a "Hello World" program is as simple as:
```
`console.log("Hello World");`
```
JavaScript's flexibility is best suited for intermediate developers. The language just helps get things done by letting the developer focus on solving the problem. Developers can use a mix of plugins and their own code snippets to get an application working.
While JavaScript is relatively easy to get started with, it is not straightforward to master. If you want to get to an advanced level, here are some of the concepts you need to know:
* **JavaScript's [multi-paradigm][8] nature:** JavaScript supports both functional programming and object-oriented programming (OOP).
* **Applying [design patterns][9] in JavaScript:** The model-view-* ([MV*][10]) design patterns have been among the most popular and have led to the development of [several modern frameworks][11].
* **[Inheritance with prototype chain][12]:** JavaScript cannot implement OOP in the traditional Java class-based model due to its dynamic nature. OOP in JavaScript is achieved through the prototypal inheritance model.
* **[Closures][13]:** A closure gives access to an outer function's scope from an inner function.
* **[Currying][14]:** Currying is a transformation of functions that translates a function from callable as f(a, b, c) into callable as f(a)(b)(c).
* **[Promises][15] and [Observables][16]:** These help you work with asynchronous functions.
* **[TypeScript][17]:** This adds static typing to JavaScript.
### 2\. Omni-platform
JavaScript can run everywhere, including:
* Devices like mobiles, tablets, and laptops
* On the client-side as well as the server-side
This ability to run everywhere makes JavaScript a universal language.
### 3\. Open standards and community
[ECMAScript][18] is the standardized version of JavaScript as well as an open standard language. Companies can use ECMAScript to create a JavaScript implementation. According to [Wikipedia][19], "an ECMAScript engine  is a program that executes source code written in a version of the ECMAScript language standard, for example, JavaScript." The most popular engines, [V8][20] and [SpiderMonkey][21], are open source projects.
JavaScript has been around for 25 years and has a vast community behind it. A developer is spoiled for choice. The community has built so many plugins and frameworks that the phrase "[framework fatigue][22]" was coined.
### 4\. Modern frameworks
Modern frameworks like [React][23], [Angular][24], and [Vue.js][25] have stabilized and are being optimized for better performance. Most frameworks are very developer-friendly with good community support.
### The future
JavaScript is here to stay. Full-stack development and the modern frontend framework continue to help JavaScript cement its position as one of the most popular programming languages.
The [next wave of JavaScript][26] might put the spotlight on:
* **[Deno][27]:** A modern and secure runtime for JavaScript
* **Web components:** Reusable custom elements
* **Integration with AI and ML:** Projects like [Supernova][28] and [BAYOU][29] have made substantial breakthroughs in integrating JavaScript with artificial intelligence and machine learning.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/javascript-popular
作者:[Nimisha Mukherjee][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/nimisha
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim)
[2]: https://octoverse.github.com/
[3]: https://en.wikipedia.org/wiki/JavaScript
[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report)
[5]: https://opensource.com/article/20/10/javascript-part-1
[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39
[7]: https://developers.google.com/web/tools/chrome-devtools
[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb
[9]: https://addyosmani.com/resources/essentialjsdesignpatterns/book/
[10]: https://developpaper.com/javascript-mv-pattern/
[11]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#JavaScript_frameworks
[12]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain
[13]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
[14]: https://javascript.info/currying-partials
[15]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
[16]: https://rxjs-dev.firebaseapp.com/guide/observable
[17]: https://en.wikipedia.org/wiki/TypeScript
[18]: https://en.wikipedia.org/wiki/ECMAScript
[19]: https://en.wikipedia.org/wiki/List_of_ECMAScript_engines
[20]: https://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29
[21]: https://en.wikipedia.org/wiki/SpiderMonkey
[22]: https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html
[23]: https://en.wikipedia.org/wiki/React_%28web_framework%29
[24]: https://en.wikipedia.org/wiki/Angular_%28web_framework%29
[25]: https://en.wikipedia.org/wiki/Vue.js
[26]: https://medium.com/@rangleio/the-future-of-javascript-in-the-front-end-world-2544c1814e2
[27]: https://en.wikipedia.org/wiki/Deno_%28software%29
[28]: https://techcrunch.com/2018/03/13/supernova-studio/
[29]: https://futurism.com/military-created-ai-learned-to-program