Coursera 笔记

Module 03 · JavaScript Programming for Web ApplicationsWeb 应用 JavaScript 编程

Module 3 Glossary: JavaScript Programming for Web Applications模块 3 术语表:Web 应用 JavaScript 编程

Coursera ↗

Term Definition
AJAX “Asynchronous JavaScript and XML” that encompasses more than asynchronous server calls through JavaScript and XML. It is not programming language or technology but rather a programming concept. Ajax represents a series of techniques that provide richer, interactive web applications through HTML, JavaScript, Cascading style sheets, and modifying the web page through the Document Object Model. The name is misleading though because nowadays, JSON is commonly used instead of XML.
异步 JavaScript 和 XML,它不仅包括通过 JavaScript 和 XML 进行的异步服务器调用。它不是编程语言或技术,而是一种编程概念。Ajax 代表一系列技术,通过 HTML、JavaScript、层叠样式表以及通过文档对象模型修改网页,提供更丰富、更互动的 Web 应用程序。尽管名称具有误导性,但如今 JSON 通常被用来代替 XML。
Anonymous Functions A type of function that has no name or we can say which is without any name. It is declared without any identifier and is often used as a parameter of another function. It is a common way to execute a function immediately after its declaration.
一种没有名称或我们可以说没有任何名称的函数类型。它没有标识符就被声明,通常用作另一个函数的参数。这是在声明后立即执行函数的常见方式。
Array A data structure that aids the programmer in the storage and retrieval of data by indexed keys. Arrays use a zero-based indexing scheme, meaning that the first element of an array has an index of zero. Arrays grow or shrink dynamically by adding or removing elements.
一种通过索引键帮助程序员存储和检索数据的数据结构。数组使用基于零的索引方案,意味着数组的第一个元素的索引为零。数组通过添加或删除元素动态地增长或缩小。
Classes Classes act as a blueprint or template for building objects with similar characteristics and behaviours. A class encapsulates data (in the form of properties) and functions (in the form of methods) that work on that data.
类作为构建具有相似特性和行为的对象的蓝图或模板。类封装了数据(以属性的形式)和在该数据上工作的函数(以方法的形式)。
Client-Side Script A program that accompanies an HTML doc or embedded in HTML. Scripts run during load of a document or when an action is performed.
一个伴随 HTML 文档或嵌入 HTML 的程序。脚本在文档加载期间或执行动作时运行。
They can be used to validate forms, process input, or dynamically create document elements.
它们可用于验证表单、处理输入或动态创建文档元素。
Embed a script in HTML, with the <script> tag in either of the following ways:
在 HTML 中嵌入脚本,使用以下任一方式中的 <script> 标签:
  • <script> // JS code </script>
  • <script src="path name"></script>
Use <noscript> tag for browsers with JavaScript disabled or ones that don’t support JavaScript.
对于禁用 JavaScript 或不支持 JavaScript 的浏览器,请使用 <noscript> 标签。
Document Objects Document representing the main web page that gives access to all HTML elements on the page. When page is loaded HTML doc becomes a document. It is referred to with “document”.
文档代表提供访问页面所有 HTML 元素的首页。当页面加载时,HTML 文档变为文档。它被称为“文档”。
DOM “Document Object Model” is a programming interface (API) between HTML and JavaScript. It allows for dynamically accessing and updating content, structure, and style. JavaScript uses the DOM to access and modify web page elements in the browser.
文档对象模型(DOM)是 HTML 和 JavaScript 之间的编程接口(API)。它允许动态访问和更新内容、结构和样式。JavaScript 使用 DOM 在浏览器中访问和修改网页元素。
Element Nodes All HTML tags.  所有 HTML 标签。
Element Objects The most general base class that all element objects in a Document inherit. It only has methods and properties common to all elements. Everything in a HTML page is an element. And one element can have other elements nested within itself.
最一般的基类,所有文档中的元素对象都继承自它。它只包含所有元素共有的方法和属性。HTML 页面中的所有内容都是一个元素。一个元素可以包含其他嵌套在其内部的元素。
Event An event is something either a browser or a user does that the JavaScript can react to such as a button click or when a user submits input on a form.
一个事件是浏览器或用户执行的操作,JavaScript 可以对其做出反应,例如按钮点击或用户在表单中提交输入。
Event Binding Refers to telling the browser that a function should be called whenever some ‘event’ occurs.
指告诉浏览器,每当发生某些“事件”时应该调用该函数。
Event Handlers A function that declares what to do when an action is performed such as the click of a button. Example:
一个声明在执行动作时(如按钮点击)要做什么的函数。例如:
<button type="button" onclick="showAnswers()"> Show Solution
 <script>
  function showAnswers() {
   //code
   alert("A")
  }
 </script>
</button>
Note that showAnswers() is an event handler.
请注意,showAnswers()是一个事件处理器。
Extend This keyword is used in class declarations or class expressions to create a class that is a child of another class.
此关键字用于类声明或类表达式中,以创建一个继承自另一个类的子类。
Functions Functions are modules of code that execute a particular task. They may take-in data, called arguments or parameters, and sometimes return data as well, called the return value. Functions are commonly defined with this syntax:
函数是执行特定任务的代码模块。它们可以接收数据,称为参数或参数,有时也会返回数据,称为返回值。函数通常使用以下语法定义:
function functionName() {
 // function code;
 // optional return statement;
}
IIFE “Immediately Invoked Function Expression” runs immediately after it is defined.  After the function executes it cannot be called again elsewhere in the program.  It is a type of self-executing function.
“立即调用的函数表达式”在定义后立即执行。函数执行后,无法在程序的其他地方再次调用。它是一种自执行函数。
Nodes The basis of all elements in the Document Object Model (DOM) structure.
文档对象模型(DOM)结构中所有元素的基础。
Objects Objects are instances created from a class. They are real-world entities that represent the characteristics defined by the class. Objects have a special set of properties that store data and methods that specify behaviours. These methods and properties can be accessed and changed to carry out specific tasks and communicate with other programs.
对象是从类中创建的实例。它们是代表由类定义的特征的现实世界实体。对象具有一组特殊的属性,用于存储数据和指定行为的方法。这些方法和属性可以被访问和修改,以执行特定任务和与其他程序通信。
Prototypes A function prototype lets you easily define and add properties or methods to an object. Prototypes exist for all objects that can be created with the keyword”new”. All object constructors create objects that inherit properties and methods that are defined by the prototype. At instantiation objects inherit the current state of the prototype. Note however, that scripts can override prototype properties and functions. Following is an example of using a prototype to add a method to the Car class:
函数原型允许您轻松定义和向对象添加属性或方法。所有可以使用“new”关键字创建的对象都存在原型。所有对象构造函数创建的对象都继承由原型定义的属性和方法。在实例化时,对象继承原型的当前状态。然而请注意,脚本可以覆盖原型属性和函数。以下是一个使用原型向 Car 类添加方法的示例:
function Car(make, model, year) {
 this.make = make;
 this.model = model;
 this.year = year;
}
Car.prototype.getName = function() {
 return this.make + ‘ ’ + this.model + ‘ ’ + this.year;
}
Script Offers developers  means to modify and extend HTML documents in highly interactive ways. Scripts can be used to validate forms or to process input as it is typed. Scripts can be triggered by events that occur on a web page, such as the clicking of a button. Scripts can be used to dynamically create document elements on an HTML page.
提供开发者以高度交互的方式修改和扩展 HTML 文档的手段。脚本可用于验证表单或处理输入时的内容。脚本可以由网页上发生的事件触发,例如按钮的点击。脚本可用于在 HTML 页面上动态创建文档元素。
Self-Executing Functions Often used to initialize data or declare DOM elements.  These functions can be  anonymous.
常用于初始化数据或声明 DOM 元素。这些函数可以是匿名的。
Text Nodes The nodes that contain actual text that go between an element start tag and end tag.
节点包含实际文本,位于元素开始标签和结束标签之间。
this Keyword “this” refers to current instance of the object. The value of “this” can vary depending on how the object is called.
关键词“this”指代对象的当前实例。 “this”的值会根据对象被调用的方式而变化。