JavaScript编程语言简介

介绍 (Introduction)

JavaScript is one of the most popular programming languages in the world.

JavaScript是世界上最受欢迎的编程语言之一。

Created in 1995, it’s gone a very long way since its humble beginnings.

自1995年创立以来,它的起点很低,已经走了很长一段路。

Being the first - and the only - scripting language that was supported natively by web browsers, it just stuck.

作为Web浏览器本地支持的第一种(也是唯一的)脚本语言,它一直处于停滞状态。

In the beginnings, it was not nearly powerful as it is today, and it was mainly used for fancy animations and the marvel known at the time as DHTML.

刚开始时,它并不像今天那样强大,它主要用于精美的动画和当时称为DHTML的奇观。

With the growing needs that the web platform demands, JavaScript had the responsibility to grow as well, to accommodate the needs of one of the most widely used ecosystems of the world.

随着Web平台需求的增长,JavaScript 有责任增长,以适应世界上使用最广泛的生态系统之一的需求。

Many things were introduced in the platform, with browser APIs, but the language grew quite a lot as well.

该平台通过浏览器API引入了许多功能,但是语言也增长了很多。

JavaScript is now widely used also outside of the browser. The rise of Node.js in the last few years unlocked backend development, once the domain of Java, Ruby, Python and PHP and more traditional server-side languages.

现在,JavaScript在浏览器之外也被广泛使用。 过去几年, Node.js的兴起解锁了后端开发,而后端开发曾经是Java,Ruby,Python和PHP以及更传统的服务器端语言的领域。

JavaScript is now also the language powering databases and many more applications, and it’s even possible to develop embedded applications, mobile apps, TV sets apps and much more. What started as a tiny language inside the browser is now the most popular language in the world.

JavaScript现在也成为语言为数据库和更多应用程序提供动力,甚至有可能开发嵌入式应用程序,移动应用程序,电视机应用程序等等。 从浏览器内部的一种很小的语言开始,到现在是世界上最受欢迎的语言。

JavaScript的基本定义 (A basic definition of JavaScript)

JavaScript is a programming language that is:

JavaScript是一种编程语言,它是:

  • high level: it provides abstractions that allow you to ignore the details of the machine where it’s running on. It manages memory automatically with a garbage collector, so you can focus on the code instead of managing memory locations, and provides many constructs which allow you to deal with highly powerful variables and objects.

    高级别 :它提供抽象,使您可以忽略正在运行的计算机的详细信息。 它使用垃圾回收器自动管理内存,因此您可以专注于代码而不是管理内存位置,并提供许多构造,使您可以处理功能强大的变量和对象。

  • dynamic: opposed to static programming languages, a dynamic language executes at runtime many of the things that a static language does at compile time. This has pros and cons, and it gives us powerful features like dynamic typing, late binding, reflection, functional programming, object runtime alteration, closures and much more.

    动态的 :与静态编程语言相反,动态语言在运行时执行静态语言在编译时执行的许多操作。 这具有优缺点,并且为我们提供了强大的功能,例如动态类型输入,后期绑定,反射,函数式编程,对象运行时更改, 闭包等等。

  • dynamically typed: a variable does not enforce a type. You can reassign any type to a variable, for example assigning an integer to a variable that holds a string.

    动态类型的 :变量不强制类型。 您可以将任何类型重新分配给变量,例如,将整数分配给包含字符串的变量。

  • weakly typed: as opposed to strong typing, weakly (or loosely) typed languages do not enforce the type of an object, allowing more flexibility but denying us type safety and type checking (something that TypeScript and Flow aim to improve)

    弱类型 :与强类型相反,弱(或松散)类型的语言不强制执行对象的类型,从而提供了更大的灵活性,但拒绝了我们进行类型安全性和类型检查( TypeScript和Flow旨在改善这一点)

  • interpreted: it’s commonly known as an interpreted language, which means that it does not need a compilation stage before a program can run, as opposed to C, Java or Go for example. In practice, browsers do compile JavaScript before executing it, for performance reasons, but this is transparent to you: there is no additional step involved.

    解释型 :通常称为解释型语言,这意味着它可以在程序运行之前不需要编译阶段,例如,与C,Java或Go相对。 实际上,出于性能原因,浏览器会在执行JavaScript之前先对其进行编译,但这对您来说是透明的:无需执行其他任何步骤。

  • multi-paradigm: the language does not enforce any particular programming paradigm, unlike Java for example which forces the use of object oriented programming, or C that forces imperative programming. You can write JavaScript using an object-oriented paradigm, using prototypes and the new (as of ES6) classes syntax. You can write JavaScript in functional programming style, with its first class functions, or even in an imperative style (C-like).

    多范式 :该语言不执行任何特定的编程范式,例如不同于Java,它强制使用面向对象的编程,而Java则强制执行命令式编程。 您可以使用面向对象的范例,原型和新的(从ES6开始)类语法来编写JavaScript。 您可以使用函数式编程风格,具有一流的功能甚至是命令式风格(类似于C)来编写JavaScript。

In case you’re wondering, JavaScript has nothing to do with Java, it’s a poor name choice but we have to live with it.

如果您想知道, JavaScript与Java无关 ,这是一个糟糕的名字选择,但我们必须忍受它。

JavaScript版本 (JavaScript versions)

Let me introduce the term ECMAScript here. We have a complete guide dedicated to ECMAScript where you can dive into it more, but to start with, you just need to know that ECMAScript (also called ES) is the name of the JavaScript standard.

让我在这里介绍术语ECMAScript 。 我们有专门针对ECMAScript的完整指南,您可以在其中进行更多研究,但是首先,您只需要知道ECMAScript(也称为ES )是JavaScript标准的名称。

JavaScript is an implementation of that standard. That’s why you’ll hear about ES6, ES2015, ES2016, ES2017, ES2018 and so on.

JavaScript是该标准的实现。 这就是为什么您会听到有关ES6,ES2015ES2016ES2017ES2018等的原因。

For a very long time, the version of JavaScript that all browsers ran was ECMAScript 3. Version 4 was canceled due to feature creep (they were trying to add too many things at once), while ES5 was a huge version for JS.

很长一段时间以来,所有浏览器运行JavaScript版本都是ECMAScript3。由于功能爬行(它们试图一次添加太多东西),版本4被取消了,而ES5是JS的巨大版本。

ES2015, also called ES6, was huge as well.

ES2015(也称为ES6 )也非常庞大。

Since then, the ones in charge decided to release one version per year, to avoid having too much time idle between releases, and have a faster feedback loop.

从那时起,负责人决定每年发布一个版本,以避免两次发布之间有太多的空闲时间,并加快反馈循环。

Currently, the latest approved JavaScript version is ES2017.

当前,最新批准JavaScript版本是ES2017

翻译自: https://flaviocopes.com/javascript-introduction/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值