JavaScript 是如何成为一门严肃的编程语言的
JavaScript

> 
> 从最开始作为一种使网站变得漂亮的方式，JavaScript 已转变为一种严肃的编程语言。
> 
> 
> 


![](/data/attachment/album/202011/12/010945vezib4p1b1ti6pjt.jpg)


JavaScript 的卑微起步始于 1995 年，是由当时在 Netscape 通信公司工作的 Brendan Eich [在短短 10 天内创建的](https://en.wikipedia.org/wiki/JavaScript)。从那时起，JavaScript 已经走过了漫长的道路，从一个让网站变得漂亮的工具变成了一种严肃的编程语言。


在其早期，JavaScript 被认为是一种视觉工具，它使网站变得更有趣和更有吸引力。像 [Jakarta Server Pages](https://en.wikipedia.org/wiki/Jakarta_Server_Pages)（即 JSP，以前称作 JavaServer Pages）这样的语言曾经用来完成渲染网页的繁重工作，而 JavaScript 则被用来创建基本的交互、视觉增强和动画。


长期以来，HTML、CSS 和 JavaScript 之间的分界并不明确。前端开发主要由 HTML、CSS 和 JavaScript 组成，形成了标准 Web 技术的“[多层蛋糕](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript)”。


![标准 Web 技术的多层蛋糕](/data/attachment/album/202011/12/011044zaggygpwldcynwfa.png "Layer cake of standard web technologies")


*标准网络技术的“[多层蛋糕](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript)”（Mozilla 开发者网络，[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)）*


HTML 和 CSS 为内容提供结构、格式和样式。一旦网页要做一些超越了显示静态内容的事情，就是 JavaScript 的用武之地。Ecma 国际部开发了 JavaScript 规范，<ruby> 万维网联盟 <rt>  World Wide Web Consortium </rt></ruby>（W3C）开发了 HTML 和 CSS 规范。


### JavaScript 是如何获得突出地位的


JavaScript 是如何成为[最受欢迎的](https://octoverse.github.com/)编程语言的，背后有一段漫长的[历史](https://blog.logrocket.com/history-of-frontend-frameworks/)。早在 20 世纪 90 年代，Java 是王者，不可避免的人们会与它进行比较。许多工程师认为 JavaScript 不是一门好的编程语言，因为它缺乏对面向对象编程的支持。尽管当时并不明显，但其实 JavaScript 的对象模型和功能特性在其第一个版本中就已经出现了。


1995 年 JavaScript 匆匆发布后，网景公司将其提交给了<ruby> 欧洲计算机制造商协会 <rt>  European Computer Manufacturers Association </rt></ruby>（ECMA）国际部进行标准化。由此产生了 [ECMAScript](https://en.wikipedia.org/wiki/ECMAScript)，这是一个 JavaScript 标准，旨在确保不同 Web 浏览器之间网页的互操作性。ECMAScript 1 于 1997 年 6 月问世，帮助推进了 JavaScript 的标准化。


在此期间，PHP 和 JSP 成为了服务器端编程语言的流行选择。JSP 作为<ruby> 通用网关接口 <rt>  Common Gateway Interface </rt></ruby>（[CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface)）的首选替代方案获得了突出的地位，因为它可以在 HTML 中嵌入 Java 代码。虽然它很受欢迎，但开发人员发现将 Java 嵌入 HTML 中是不自然的。此外，即使是 HTML 上最简单的文本变化，JSP 也必须经历一个耗时的生命周期。在今天的微服务世界里，面向 JSP 的页面被认为是技术债务。


[PHP](https://en.wikipedia.org/wiki/PHP#:~:text=PHP%20development%20began%20in%201994,Interpreter%22%20or%20PHP%2FFI.) 的工作原理与 JSP 类似，但 PHP 代码以一个通用网关接口（[CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface)）的可执行文件来处理。基于 PHP 的 Web 应用比基于 JSP 的应用更容易部署。总的来说，使用 PHP 更容易上手和运行。今天，PHP 和 JavaScript 是创建动态网站最流行的组合之一：PHP 作为服务器端脚本，JavaScript 作为客户端脚本。


伴随着 2006 年 [jQuery](https://en.wikipedia.org/wiki/JQuery) 的发布，JavaScript 的应用越来越多。jQuery 是一个多用途的 JavaScript 库，简化了繁琐的<ruby> 文档对象模型 <rt>  Document Object Model </rt></ruby>（DOM）管理、事件处理和 [Ajax](https://en.wikipedia.org/wiki/Ajax_(programming))。


2009 年 [Node.js](https://en.wikipedia.org/wiki/Node.js) 的发布是 JavaScript 发展的转折点。开发者现在可以用 JavaScript 编写服务器端脚本了。紧随其后的是 2010 年发布的 [Backbone.js](https://en.wikipedia.org/wiki/Backbone.js) 和 [AngularJS](https://en.wikipedia.org/wiki/AngularJS) 等框架。这导致了出现了使用单一语言进行全栈开发的概念。


2015 年，Ecma 国际部发布了 ECMAScript 6（ES6），它为编写复杂的应用程序增加了包括类声明在内的重要新语法。其他新特性还包括迭代器、箭头函数表达式、`let` 和 `const` 关键字、类型化数组、新的集合（映射、集合和 WeakMap）、Promise、字符串的模板字元以及许多其它很酷的特性。后来的版本又继续增加了更多的功能，使 JavaScript 更加强大、精简和可靠。


### 总结


在过去的 20 年里，JavaScript 有了长足的进步。现在大多数浏览器都在争相满足合规性，因此最新的规范推出得更快。


根据你的项目需求，有大量稳定的 JavaScript 框架可供选择，包括最流行的 [React](https://reactjs.org/)、[Angular](https://angular.io/) 和 [Vue.js](https://vuejs.org/) 等等。在本系列的下一篇文章中，我将深入探讨为什么 JavaScript 如此受欢迎。




---


via: <https://opensource.com/article/20/10/history-javascript>


作者：[Nimisha Mukherjee](https://opensource.com/users/nimisha) 选题：[lujun9972](https://github.com/lujun9972) 译者：[wxy](https://github.com/wxy) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
JavaScript's humble start began in 1995, when it was [created in just 10 days](https://en.wikipedia.org/wiki/JavaScript) by Brendan Eich, then an employee with Netscape Communications Corporation. JavaScript has come a long way since then, from a tool to make websites pretty to a serious programming language.

In its early days, JavaScript was considered a visual tool that made websites a little more fun and attractive. Languages like [Jakarta Server Pages](https://en.wikipedia.org/wiki/Jakarta_Server_Pages) (JSP; formerly JavaServer Pages) used to do all the heavy lifting on rendered web pages, and JavaScript was used to create basic interactions, visual enhancements, and animations.

For a long time, the demarcations between HTML, CSS, and JavaScript were not clear. Frontend development primarily consists of HTML, CSS, and JavaScript, forming a "[layer cake](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript)" of standard web technologies.

![Layer cake of standard web technologies Layer cake of standard web technologies](https://opensource.com/sites/default/files/uploads/layercakewebtech.png)

opensource.com

HTML and CSS provide structure, format, and style to content. JavaScript comes into play once a web page does something beyond displaying static content. Ecma International develops JavaScript specifications, and the World Wide Web Consortium (W3C) develops HTML and CSS specifications.

## How JavaScript gained prominence


There is a long [history](https://blog.logrocket.com/history-of-frontend-frameworks/) behind how JavaScript came to be the [most popular](https://octoverse.github.com/) programming language. Back in the 1990s, Java was king, and comparisons to it were inevitable. Many engineers thought JavaScript was not a good programming language due to lack of support for object-oriented programming. Even though it was not evident, JavaScript's object-model and functional features were already present in its first version.

After JavaScript's rushed release in 1995, Netscape submitted it to the European Computer Manufacturers Association (ECMA) International for standardization. This led to [ECMAScript](https://en.wikipedia.org/wiki/ECMAScript), a JavaScript standard meant to ensure interoperability of web pages across different web browsers. ECMAScript 1 came out in June 1997 and helped to advance the standardization of JavaScript.

During this time, PHP and JSP became popular server-side language choices. JSP had gained prominence as the preferred alternative to Common Gateway Interface ([CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface)) because it enabled embedding Java code in HTML. While it was popular, developers found it unnatural to have Java inside HTML. In addition, even for the simplest text change on HTML, JSP had to undergo a time-consuming lifecycle. In today's microservice world, JSP-oriented pages are considered technical debt.

[PHP](https://en.wikipedia.org/wiki/PHP#:~:text=PHP%20development%20began%20in%201994,Interpreter%22%20or%20PHP%2FFI.) works similarly to JSP but the PHP code is processed as a Common Gateway Interface ([CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface)) executable. PHP-based web applications are easier to deploy than those based on JSP. Overall, it is easier to get up and running with PHP. Today, PHP and JavaScript are one of the most popular combinations for creating dynamic websites. PHP serves as the server-side scripting and JavaScript as the client-side scripting.

JavaScript's adoption grew with the release of [jQuery](https://en.wikipedia.org/wiki/JQuery), a multi-purpose JavaScript library that simplifies tedious Document Object Model (DOM) management, event handling, and [Ajax](https://en.wikipedia.org/wiki/Ajax_(programming)), in 2006.

The turning point for JavaScript came in 2009 when [Node.js](https://en.wikipedia.org/wiki/Node.js) was released. Developers could now write server-side scripting with JavaScript. Closely following were frameworks like [Backbone.js](https://en.wikipedia.org/wiki/Backbone.js) and [AngularJS](https://en.wikipedia.org/wiki/AngularJS), both released in 2010. This led to the concept of full-stack development using a single language.

In 2015, Ecma International released ECMAScript 6 (ES6), which added significant new syntax for writing complex applications, including class declarations. Other new features included iterators, arrow function expressions, let and const keywords, typed arrays, new collections (maps, sets, and WeakMap), promises, template literals for strings, and many other cool features. Later editions have gone on to add more features that have made JavaScript more robust, streamlined, and reliable.

## Conclusion

JavaScript has advanced significantly over the past two decades. Most browsers now compete to meet compliance, so the latest specifications are rolled out faster.

There are a host of stable JavaScript frameworks to choose from, depending on your project requirements, including the most popular ones: [React](https://reactjs.org/), [Angular](https://angular.io/), and [Vue.js](https://vuejs.org/). In the next article in this series, I'll dive into why JavaScript is so popular.

## 2 Comments