什么是JavaScript?在哪里可以学习它?​

JavaScript / 1051人浏览 / 0人评论

我们大多数人都不知道,我们每天都会大量使用JavaScript几十次。从台式电脑、手机到智能电视,甚至是现代汽车,我们每天使用的几乎每一个联网设备都大量使用JavaScript来帮助我们浏览网络和生活在数字生活中。

我们大多数人都不知道,我们每天都会大量使用JavaScript几十次。从台式电脑、手机到智能电视,甚至是现代汽车,我们每天使用的几乎每一个联网设备都大量使用JavaScript来帮助我们浏览网络和生活在数字生活中。

什么是JavaScript?在哪里可以学习它?(What is JavaScript and Where Can I Learn It?)

什么是JavaScript?

Unbeknownst to most of us, we all make heavy use of JavaScript dozens of times a day. From desktop computers and mobile phones to smart TVs and even modern cars, nearly every connected device we use on a daily basis makes heavy use of JavaScript to help us browse the web and live out our digital lives.

我们大多数人都不知道,我们每天都会大量使用JavaScript几十次。从台式电脑、手机到智能电视,甚至是现代汽车,我们每天使用的几乎每一个联网设备都大量使用JavaScript来帮助我们浏览网络和生活在数字生活中。

In spite of the ubiquity of JavaScript you may still be wondering, “What is JavaScript, exactly?” (Just to clarify, JavaScript is not Java.)

尽管JavaScript无处不在,但您可能仍在想,“JavaScript到底是什么?“(为了澄清,JavaScript不是Java。)

JavaScript无处不在

At its core, JavaScript is a programming language which is used to facilitate interactions between a user’s web browser and the website or service the user is visiting. Virtually every aspect of the browsing experience — from the visual look and feel of a site to the underlying information that represents the movie titles being displayed on sites like Netflix — can be altered within the browser using JavaScript.

JavaScript的核心是一种编程语言,用于促进用户的web浏览器与用户访问的网站或服务之间的交互。实际上,浏览体验的每个方面——从网站的视觉外观到表示Netflix等网站上显示的电影标题的基本信息——都可以在浏览器中使用JavaScript进行更改。

By being able to interact with every object that makes up a web page, JavaScript can perform some very magical tasks. Even so, the most mundane uses of JavaScript are witnessed by users so frequently that many people may not even realize JavaScript is under the hood. Common implementations of JavaScript include: confirming that the user has entered a properly formatted email address into a form; automatically placing the text cursor into a search box when loading a page like Google.com; or loading small sections of a page, such as the next series of movies in a list, without the need to reload the entire page.

通过能够与构成web页面的每个对象交互,JavaScript可以执行一些非常神奇的任务。即便如此,用户还是会频繁地看到JavaScript最普通的使用,以至于很多人甚至都没有意识到JavaScript是隐藏在幕后的。JavaScript的常见实现包括:确认用户在表单中输入了格式正确的电子邮件地址;在加载Google.com这样的页面时自动将文本光标放入搜索框;或者加载页面的小部分,例如列表中的下一系列电影,而无需重新加载整个页面。

At the simplest level, JavaScript code is loaded behind-the-scenes when a web page is visited in nearly any modern browser. Once that page has finished loading and is displayed on screen, the JavaScript code is executed and instructs the browser what additional actions (if any) should take place. If no immediate action is to take place (such as placing the text cursor in a search box), then typically the JavaScript code simply sits idle, waiting for a particular event to occur, at which point the JavaScript code fires and performs a necessary action.

在最简单的级别上,当在几乎任何现代浏览器中访问网页时,JavaScript代码都是在后台加载的。一旦页面完成加载并显示在屏幕上,JavaScript代码就会执行并指示浏览器应该执行哪些附加操作(如果有的话)。如果不立即执行任何操作(例如将文本光标放在搜索框中),则通常JavaScript代码只是处于空闲状态,等待特定事件发生,此时JavaScript代码将触发并执行必要的操作。

For example, when filling out the password box in a registration form, JavaScript will often be waiting for the moment when the user begins typing characters into the password box. In the event that the user types a special character that this particular web page doesn’t allow as part of a valid password, the JavaScript code will immediately notice this issue and pop up a small text alert near the password field, informing the user of this issue.

例如,在注册表单中填写密码框时,JavaScript通常会等待用户开始在密码框中键入字符的那一刻。如果用户键入此特定网页不允许作为有效密码一部分的特殊字符,JavaScript代码将立即注意到此问题,并在“密码”字段附近弹出一个小文本警报,通知用户此问题。

While adept users may consider or even recognize that this verification process of ensuring the password field contains valid characters can be performed by the server (the remote computer hosting the website), this illustrates the fundamental power of JavaScript as a technology: JavaScript can perform tasks immediately, directly on the device the user is interacting with, without the delays normally necessary when sending and receiving information from a web site.

虽然熟练的用户可能会考虑甚至认识到,服务器(托管网站的远程计算机)可以执行这种确保密码字段包含有效字符的验证过程,但这说明了JavaScript作为一种技术的基本威力:JavaScript可以直接在设备上执行任务用户正在与之交互,在从网站发送和接收信息时通常不需要延迟。

Why is JavaScript Essential?

Aside from the power and control that implementing JavaScript into a website has for the company behind that site, it’s also critical to understand just how vital JavaScript as a technology is, both at present and well down the road for the foreseeable future. Having a solid grasp of what JavaScript is, and perhaps even how to begin coding and working with it, are among the most crucial skills anyone interested in web technologies or development can gain.
为什么JavaScript是必需的?

除了将JavaScript实现到网站中对网站背后的公司具有强大的力量和控制力外,了解JavaScript作为一项技术在当前和可预见的未来的重要性也是至关重要的。掌握JavaScript是什么,甚至是如何开始编写和使用JavaScript,是任何对web技术或开发感兴趣的人都能获得的最关键的技能之一。

A multitude of technologies have sprung up in recent years that heavily focus on utilizing the power of JavaScript.

近年来涌现出了大量的技术,这些技术主要集中在利用JavaScript的能力上。

Node.js, a server-side JavaScript library built using Google’s V8 JavaScript engine, is among the most dominant of these technologies. Node.js is powerful and robust enough that, over the last few years, a great number of big name companies have migrated their services from older technologies to Node.js, including Netflix, PayPal, and Uber. What makes Node.js so interesting is that, unlike most implementations of JavaScript in the past, Node.js allows JavaScript to be the backbone language that handles everything on the server itself, rather than merely managing interactions only on the user’s computer.

Node.js是使用Google的V8 JavaScript引擎构建的服务器端JavaScript库,是这些技术中最主要的一种。Node.js功能强大、功能强大,在过去几年中,许多大公司已经将其服务从旧技术迁移到Node.js,包括Netflix、PayPal和Uber。让Node.js如此有趣的是,与过去大多数JavaScript实现不同的是,Node.js允许JavaScript成为处理服务器本身所有内容的主干语言,而不仅仅是管理用户计算机上的交互。

Not only is JavaScript widely used by massive companies and services, in fact all signs indicate that it is among the most popular programming languages used day-to-day by developers worldwide.

JavaScript不仅被大型公司和服务广泛使用,事实上所有迹象都表明它是世界各地开发人员日常使用的最流行的编程语言之一。

转载注明:

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我