ECMAScript2015文檔概述

4、概述 Overview

  1. ECMAScript is an object-oriented programming language for performing computations and manipulating computational objects within a host environment.
  2. ECMAScript was originally designed to be used as a scripting language, but has become widely used as a general purpose programming language.
  3. Therefore the core language is specified in this document apart from any particular host environment.

ECMAScript 是面向對象的通用型編程語言,需要在宿主環境中使用,但是ECMAScript 語言的核心是不涉及這些宿主環境的

4.1 Web Scripting

Each Web browser and server that supports ECMAScript supplies its own host environment, completing the ECMAScript execution environment.

  1. ECMAScript的兩個宿主環境:web瀏覽器、web服務器,
  2. 不同的宿主環境提供了不同的web腳本:比如瀏覽器中提供window窗口對象供操作、服務器中提供request代表請求的對象來獲取客戶端請求內容

4.2 ECMAScript Overview

【1】何爲基本數據類型?對象是什麼?函數是什麼?方法又是什麼?

A primitive value is a member of one of the following built-in types: Undefined, Null, Boolean, Number, **String,**and **Symbol; **
an object is a member of the built-in type Object; and a function is a callable object.
A function that is associated with an object via a property is called a method.

【2】內置對象有哪些,如何分類

  1. objects that are fundamental to the runtime semantics of the language including Object, Function, Boolean, Symbol, and various **Error **objects;
  2. objects that represent and manipulate numeric values including Math, Number, and Date;
  3. the text processing objects **String **and RegExp;
  4. objects that are indexed collections of values including **Array **;
  5. keyed collections including **Map **and **Set **objects;
  6. objects supporting structured data including the **JSON **object, ArrayBuffer, and DataView;
  7. objects supporting control abstractions including generator functions and **Promise **objects;
  8. reflection objects including **Proxy **and Reflect.

【3】ECMAScript 定義的操作符_ operators._ 還支持模塊_modules_
_

4.2.1 Objects

  1. Each constructor is a function that has a property named **“prototype” **that is used to implement **prototype-based inheritance **and shared properties. Objects are created by using constructors in **new **expressions
  2. Every object created by a constructor has an implicit reference (called the object’s prototype) to the value of its constructor’s **“prototype” **property. Furthermore, a prototype may have non-null implicit reference to its prototype, and so on; this is called the prototype chain
  1. 對象怎麼來的?
  2. 原型和原型鏈是什麼?

在這裏插入圖片描述

4.2.2 The Strict Variant of ECMAScript

They might do so in the interests of security, to avoid what they consider to be error-prone features, to get enhanced error checking, or for other reasons of their choosing.
In support of this possibility, ECMAScript defines a strict variant of the language

出於一些場合的要求(代碼安全性、健壯性),ECMAScript定義了一種語言的變體 - 嚴格模式。
在非嚴格模式下可用的代碼在嚴格模式下可能會拋出錯誤

4.3 術語和定義

一些重要的術語和定義:
undefined value
primitive value used when a variable has not been assigned a value
null value
primitive value that represents the intentional absence of any object value
method
function that is the value of a property

4.4 本規範的組織(Organization of This Specification)

該規範的組織結構

  • Clause 5 defines the notational conventions used throughout the specification.
  • Clauses 6−9 define the execution environment within which ECMAScript programs operate.
  • Clauses 10−16 define the actual ECMAScript programming language including its syntactic encoding and the execution semantics of all language features.
  • Clauses 17−26 define the ECMAScript standard library. It includes the definitions of all of the standard objects that are available for use by ECMAScript programs as they execute.

Clauses 10往後纔是重點介紹ECMAScript語法和用法的。

【更好的閱讀體驗,請移步 鏈接
【更多ES6文檔解讀,請移步 鏈接

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章