ECMA-262 Extractions
For the purpose of this article, ECMA-262 refers to ECMAScript® 2017 Language Specification.
ECMAScript Data Types & Values
- Each value has an associated type.
- Types are subclassified into ECMASCript language types & specification types.
- An ECMAScript language type (ESLT) corresponds to values that are directly manipulated by an ECMAScript programmer using the ECMAScript language.
- the ESLTs are
Undefined
,Null
,Boolean
,String
,Symbol
,Number
, andObject
. - An ECMAScript language value (ESLV) is a value that is characterized by an ESLT.
- A type is a set of data values.
object
- An object is a member of the type
Object
. - A property is part of an object that associates a key (key, also termed "key value", is either a
String
value, including the empty string, or aSymbol
value) and a value. - An object is a collection of properties and has a single "prototype" property.
- A prototype is an object that provides shared properties for other objects.
- Each property is either a data property, or an accessor property:
- A data property associates a key value with an ESLV and a set of
Boolean
attributes. - An accessor property associates a key with one or two accessor functions, and a set of
Boolean
attributes. The accessor functions are used to store or retrieve an ESLV that is associated with the property.
- A data property associates a key value with an ESLV and a set of
- An own property is a property that is directly contained by its object.
- An inherited property of an object is one that is not an own property but is a property (either own or inherited) of the object's prototype.
- A function is an object that may be invoked as a subroutine.
- A method of an object is a function that is the value of a property.
- An attribute of a property is an internal value that defines characteristic of the property.
More about objects:
Even though ECMAScript (ES) include syntax for class definitions, ES objects are not fundamentally class-based such as those in C++, Smalltalk, or Java. Instead objects may be created in various ways including via literal notation or via constructors which creates objects and then execute code that initializes all or part of them by assigning 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.
Every object created by a constructor has an implicit reference to the value of its constructor's "prototype" property. Further more, 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 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.