开发工具:
文件大小: 11mb
下载次数: 0
上传时间: 2019-07-13
详细说明:ECMA标准issues were filed representing thousands of bug fixes, editorial fixes and other improvements. Additionally, numerous
software tools were developed to aid in this effort including ecmarkup, Ecmarkdown, and Grammarkdown ES2016 also
included support for a new exponentiation operator and adds a new method to Array prototype called includes
ECMAScript 20 17 introduced Async Functions, Shared Memory, and Atomics along with smaller language and library
enhancements, bug fixes, and editorial updates. Async functions improve the asynchronous programming experience by
providing syntax for promise-returning functions Shared Memory and Atomics introduce a new memory model that allows
multi-agent pro grams to communicate using atomic o perations that ensure a well-defined execution order even on parallel
CPUs. This specification also includes new static methods on Object: Object values, Object. entries, and
object. getownProperty Descriptors
ECMAScript 2018 introduced support for asynchronous iteration via the Asynclterator protocol and async generators. It also
included four new regular expression features: the dotAll flag, named capture groups, Unicode property escapes, and look-
behind assertions. Lastly it included rest parameter and spread operator support for object properties
This specification, the 10edition, intro duces a few new built-in functions: flat and flatMap on Array prototype for
flattening arrays, object. fromEntries for directly turning the return value of object. entries into a new object, and
trimStart and trimEnd on String prototype as better-named alternatives to the widely implemented but non-standard
String prototype trimLeft and trimRight built-ins. In addition, this specification includes a few minor updates to
syntax and semantics. Updated syntax includes optional catch binding parameters and allowing U+2028 ( LINE SEPARATOR
and U+ 2029(PARaGRaPH SEParatoR in string literals to align with jSoN. Other updates include requiring that
Array prototype sort be a stable sort, requiring that jsoN stringify return well-formed utF-8 regardless ofinput, and
clarifying Function prototype tostring by requiring that it either return the corresponding original source text ora
standard placeholder
Dozens of individuals representing many organizations have made very significant contributions within Ecma tC39 to the
development of this edition and to the prior editions. In addition, a vibrant community has emerged supporting TC39's
ECMAScript efforts. This community has reviewed numerous drafts, filed thousands of bug reports, performed implementation
experiments, contributed test suites, and educated the world-wide developer community about ECMAScript. Unfortunately, it
is impossible to identify and acknowledge every person and organization who has contributed to this effort.
Allen wirfs-Brock
ECMA-262, Project Editor, 6 Edition
Brian telson
ECMA-262, Project Editor, 7 through 10 Editions
1 Scope
This Standard defines the eCmaScript 2019 general- purpose programming language
2 Conformance
A conforming implementation of ECMAScript must provide and support all the types, values, objects, properties, functions, and
pro gram syntax and semantics described in this specification
A conforming implementation of ECMAScript must interpret source text input in conformance with the latest version of the
Unicode Standard and ISO/IEC 10646
A conforming implementation of ECMAScript that provides an application programming interface (APD) that supports
programs that need to adapt to the linguistic and cultural conventions used by different human languages and countries must
implement the interface defined by the most recent edition of ECMA-402 that is compatible with this specification
A conforming implementation of ECMAScript may provide additional types, values, objects, properties, and functions beyond
those described in this specification. In particular, a conforming implementation of ECMAScript may provide properties not
described in this specification, and values for those properties for objects that are described in this specification
A conforming implementation of ECMAScript may support program and regular expression syntax not described in this
specification. In particular, a conforming implementation of ECMAScript may support program syntax that makes use of the
future reserved words"listed in subclause 11.6.2.2 of this specification
A conforming implementation of ECMAScript must notimplement any extension that is listed as a Forbidden Extension in
subclause 16.2
3 Normative references
The following referenced documents are indispensable for the application of this document. For dated references, only the
edition cited applies For undated references, the latest edition of the referenced document (including any amendments)
applies
ISO/IEC 10646 Information Technology -Universal Multiple-Octet Coded Character Set (UCS)plus Amendment 1: 2005,
Amendment 2: 2006, Amendment 3: 2008, and Amendment 4: 2008, plus additional amendments and corrigenda, or successor
ECMA-402, ECMAScript 2015 Internationalization API Specification
https://ecma-international.org/publications/standards/ecma-402.htm
ECMA-404, The SoN Data Interchange Format.
https://ecma-international.org/publications/standards/ecma-404.htm
4 Overview
This section contains a non-normative overview of the eCmascript language.
ECMAScript is an object-oriented programming language for performing computations and manipulating computational
objects within a host environment. ECMAScript as defined here is not intended to be computationally self-sufficient; indeed,
there are no provisions in this specification for input of external data or output of computed results. Instead, it is expected that
the computational environment of an ECMAScript program will provide not only the objects and other facilities described in
this specification but also certain environment-specific objects, whose description and be haviour are beyond the scope of this
specification except to indicate that they may provide certain properties that can be accessed and certain functions that can be
called from an ECMAScript program
ECMAScript was originally designed to be used as a scripting language but has become widely used as a general-purpose
programming language. a scripting language is a programming language that is used to manipulate, customize, and automate
the facilities of an existing system. In such systems, useful functionality is already available through a user interface, and the
scripting language is a mechanism for exposing that functionality to program control. In this way, the existing system is said to
provide a host environment of objects and facilities, which completes the capabilities of the scripting language. A scripting
language is intended for use by both professional and non-professional programmers
ECMAScript was originally designed to be a Web scripting language, providing a mechanism to enliven Web pages in browsers
and to perform server computation as part of a Web-based client-server architecture. ECMAScript is now used to provide core
scripting capabilities for a variety of host environments. Therefore the core language is specified in this document apart from
any particular host environment
ECMAScript usage has moved beyond simple scripting and it is now used for the full spectrum of programming tasks in many
different environments and scales. As the usage of ECMAScript has expanded, so has the features and facilities it provides
ECMAScript is now a fully featured general-purpose programming language
Some of the facilities of ECmaScript are similar to those used in other programming languages; in particular c, Java m, Self, and
Scheme as des cribed in:
ISO/EC 9899: 1996, Programming Languages-C
Gosling, James, Bill Joy and Guy Steele. The Java Language Specification. Addison Wesley Publishing Co., 1996
Ungar, David, and Smith, Randall B Self: The Power of Simplicity. OOPSLA 87 Conference Proceedings, pp. 227-241, Orlando,
FL October 1987,
IEEE Standard for the Scheme Programming Language. IEEE Std 1178-1990
4.1 Web Scripting
a web browser provides an ECMAScript host environment for client-side computation including, for instance, objects that
represent windows, menus, pop-ups, dialog boxes, text areas, anchors, frames, history, cookies, and input/output. Further, the
host environment provides a means to attach scripting code to events such as change of focus, page and image loading
unloading, error and abort, selection, form submission, and mouse actions. Scripting code appears within the html and the
displayed page is a combination of user interface elements and fixed and computed text and images. The scripting code is
reactive to user interaction, and there is no need for a main program
A web server provides a different host environment for server-side computation including objects representing requests,
clients, and files; and mechanisms to lock and share data. By using browser-side and server-side scripting together, it is
possible to distribute computation between the client and server while providing a customized user interface for a Web-based
application
Each Web browser and server that supports ECMAScript supplies its own host environment, completing the eCmaScript
execution environment
4.2 ECMAScript Overview
The following is an informal overview of ECMAScript--not all parts of the language are described. This overview is not part of
the standard proper.
ECMAScriptis object-based: basic language and host facilities are provided by objects, and an ECMAScript program is a cluster
of communicating objects In ECMAScript, an object is a collection of zero or more properties each with attributes that
determine how each property can be used-for example, when the Writable attribute for a property is set to false, any
attempt by executed eCmAScript code to assign a different value to the property fails. Properties are containers that hold other
objects, primitive values, or functionS. A primitive value is a member of one of the follo wing 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
ECMAScript defines a collection of built-in objects that round out the definition of ECMAScript entities. These built-in objects
include the global object; objects that are fundamental to the runtime semantics of the language including Object, Function,
Boolean, Symbol, and various Error objects; objects that represent and manipulate numeric values including Math, Number,
and Date; the text processing objects String and RegExp; objects that are indexed collections of values including Array and
nine different kinds of Typed Arrays whose elements all have a specific numeric data representation; keyed collections
including Map and Set objects; objects supporting structured data including the JSoN object, Array Buffer,
SharedArrayBuffer, and DataView; objects supporting control abstractions including generator functions and Promise
objects; and reflection objects including Proxy and Reflect
ECMAScript also defines a set of built-in operators. ECMAScript operators include various unary operations, multiplicative
operators, additive operators, bitwise shift operators, relational operators, equality operators, binary bitwise operators,
binary logical operators, assignment operators, and the comma operator
Large ECMAScript programs are supported by modules which allow a pro gram to be divided into multiple sequences of
statements and declarations. Each module explicitly identifies declarations it uses that need to be provided by other modules
and which of its declarations are available for use by other modules
ECMAScript syntax intentionally resembles Java syntax. ECMAScript syntax is relaxed to enable it to serve as an easy-to-use
scripting language. For example, a variable is not required to have its type declared nor are types associated with properties,
and defined functions are not required to have their declarations appear textually before calls to them
4.2.1 Objects
Even though ECMAScript includes syntax for class definitions, ECMAScript objects are not fundamentally class-based such as
those in C++, Smalltalk, or Java. Instead objects may be created in various ways including via a literal notation or via
constructors which create objects and then execute code that initializes all or part of them by assigning initial values to their
properties. 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; for example,
new Date(2009, 11)creates a new Date object. Invoking a constructor without using new has consequences that depend
on the constructor. For example, Date( produces a string representation of the current date and time rather than an object
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 a non-null implicit reference to its prototype, and so on; this is
called the prototype chain. When a reference is made to a property in an object, that reference is to the property of that name in
the first object in the prototype chain that contains a property of that name. In other words, first the object mentioned directly
is examined for such a property; if that object contains the named property that is the property to which the reference refers
if that object does not contain the named property, the prototype for that object is examined next; and so on
Figure 1: Object/Prototype Relationships
CF
implicit prototype link
prototype
CF
explicit prototype property
R2
CFPT
c
cf
In a class-based object-oriented language in general, state is carried by instances methods are carried by classes and
inheritance is only of structure and behaviour. In ECmAScript, the state and methods are carried by objects, while structure,
behaviour, and state are all inherited
All objects that do not directly contain a particular property that their prototype contains share that property and its value
Figure 1 illustrates this
Cf is a constructor (and also an object). Five objects have been created by using new expressions: cf1, cf2, cf,, cfa, and cfs
Each of these objects contains properties named q1 and q2. The dashed lines represent the implicit prototype relationship; So,
for example, cf3's prototype is CFp. The constructor, CF, has two properties itself, named P1 and P2, which are not visible to
CFp cf1, cf2, cf3, cf4, or cfs. The property named CFPl in CF p is shared by cf1, cf2, cf3, cf4, and cfs(but not by CF), as are any
properties found in CFps implicit prototype chain that are not named q1, 2, or CFP1. Notice that there is no implicit
prototype link between CF and CFp
constructors are not required to name or assign values to all or any of the constructed object s properties. In the above hat is
Unlike most class-based object languages, properties can be added to objects dynamically by assigning values to them. tha
diagram, one could add a new shared property for cf1, cf2, cf3, cf4, and cfs by assigning a new value to the property in CF
Although ECMAScript objects are not inherently class-based, it is often convenient to define class-like abstractions based upon
a common pattern of constructor functions, prototype objects, and methods. The ECMAScript built-in objects themselves
follow such a class-like pattern. Beginning with ECMAScript 2015, the ECMAScript language includes syntactic class definitions
that permit programmers to concisely define objects that conform to the same class-like abstraction pattern used by the built
in objects
4.2.2 The strict Variant of ECMAScript
The ECmAScript Language recognizes the possibility that some users of the language may wish to restrict their usage of some
features available in the language. 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 The strict variant of the language excludes some specific syntactic and semantic
features of the regular ECMAScript language and modifies the detailed semantics of some features. The strict variant also
specifies additional error conditions that must be reported by throwing error exceptions in situations that are not specified as
errors by the non-strict form of the language
The strict variant of ECMAScript is commonly referred to as the strict mode of the language. Strict mode selection and use of
the strict mode syntax and semantics of ECMAScript is explicitly made at the level of individual eCmascript source text units
Because strict mode is selected at the level of a syntactic source text unit, strict mode only imposes restrictions that have local
effect within such a source text unit. Strict mode does not restrict or modify any aspect of the ECmAScript semantics that must
operate consistently across multiple source text units. A complete eCMAScript program may be composed of both strict mode
and non-strict mode eCmascript source text units. In this case, strict mode only applies when actually executing code that is
defined within a strict mode source text unit.
In order to conform to this specification, an ECMAScript implementation must implement both the full unrestricted
ECMAScript language and the strict variant of the eCmaScript language as defined by this specification. In addition, an
implementation must support the combination of unrestricted and strict mode source text units into a single composite
program.
4.3 Terms and definitions
For the purposes of this document, the following terms and definitions apply.
4.3.1 tvpe
set of data values as defined in clause 6 of this specification
4.3.2 primitive value
member of one of the types Undefined, Null, Boolean, Number, Symbol, or String as defined in clause 6
NOTE
A primitive value is a datum that is represented directly at the lowest level of the language implementation
4.3.3 object
member of the type object
NOTE
An object is a collection of properties and has a single prototype object. The prototype may be the null value
43.4 constructor
function object that creates and initializes objects
NOTE
The value of a constructor's prototype property is a prototype object that is used to implement inheritance and shared
properties
4.3.5 prototype
object that provides shared properties for other objects
NOTE
When a constructor creates an object, that object implicitly references the constructor's prototype property for the purpose
of resolving property references. The constructor's prototype property can be referenced by the program expression
constructor. prototype, and properties added to an object's prototype are shared, through inheritance, by all objects
sharing the prototype. Alternatively, a new object may be created with an explicitly specified prototype by using the
Object create built-in function
4.3.6 ordinary object
object that has the default behaviour for the essential internal methods that must be supported by all objects
4.3.7 exotic object
object that does not have the default behaviour for one or more of the essential internal methods
NOTE
Any object that is not an ordinary object is an exotic object
4.3.8 standard object
object whose semantics are defined by this specification
4.3.9 built-in object
object specified and supplied by an eCmaScript implementation
NOTE
Standard built-in objects are defined in this specification. An ECMAScript implementation may specify and supply additional
kinds of built-in objects. A built-in constructor is a built-in object that is also a constructo
43.10 undefined value
primitive value used when a variable has not been assigned a value
4.3.11 Undefined type
type whose sole value is the undefined value
43.12 null value
primitive value that represents the intentional absence of any object value
4.3.13 Null type
type whose sole value is the null value
43.14 Boolean value
member of the boolean type
NOTE
There are only two Boolean values, true and false
4.3.15 Boolean type
type consisting of the primitive values true and false
4.3.16 Boolean object
member of the object type that is an instance of the standard built-in Boolean constructor
NOTE
A Boolean object is created by using the Boolean constructorin a new expression, supplying a boolean value as an argument
The resulting object has an internal slot whose value is the boolean value. a Boolean object can be coerced to a boolean value
4.3.17 String value
primitive value that is a finite ordered sequence of zero or more 16-bit unsigned integervalues
NOTE
A String value is a member of the String type. Each integer value in the sequence usually represents a single 16-bit unit of UTF
16 text. However, ECMAScript does not place any restrictions or requirements on the values except that they must be 16-bit
unsigned integers
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.