A Value is synonymous with ECMAScript Language Types, a fundamental data atom of javascript. A value can be primitive:
- Undefined
- Null
- Boolean
- String
- Symbol
- Number
- BigInt or an object.
There is a difference between a:
- String value (string), which is a primitive value and is represented by a series of 16bits characters,
is immutable, is only uniquely identified by its content and can be creates with
String(123)
and a - String object (String) which is an immutable object, itself containing a String value, is, like all object,
unique and can be created with
new String(123)
.
String(123) === String(123) -> true
new String(123) === new String(123) -> false
Types used in the specification but not meant to be manipulated by the javascript program but only by the implementation are ECMAScript Specification Types. These includes Reference Record, List, Completion Record, Property Descriptor, Environment Record, Abstract Closure, and Data Block.
A Record is am ECMAScript Specificatons Type. It's used in the spec to identify an aggregation of properties. It is not accessible by the js programmer.
An Object (6.1.7) is a value directly manipulated by the programmer. It is a collection of properties which associates:
- A key: string of
Symbol
. When a string is used we have a named property. A string key is a propery name. If the string can be convert to an integer, it is an integer index. - A value: primitive value, object or function.
- A set of boolean attributes:
[[Writable]]
,[[Enumerable]]
, etc. - A get and set defined for accessor property (without those accessor we have a data property).
Each object has a prototype which is used as a parent in the javascript inheritance scheme.
An object has internal methods ([[Get]]
, [[Set]]
, etc.) and slots ([[Prototype]]
, [[Extensible]]
, etc.)
not accessible by the programmer and which defines the object behavior.
An object is unique and can only be equal to itself (SameValue
or ===).
Ordinary objects are defined according to the internal methods and slots they implement as described in 10.1. function objects are ordinary objects.
An exotic object is an object that is not an ordinary objects. Examples are Array
, String
, or Args
. For example, the Array constructor takes a length, so does not follow the definition of OrdinaryObjectCreate
.
Intrinsic Objects (or builtin objects) are supplied by the ECMAScript implementations. Well known objects like
Object
, Array
, Function
, Boolean
, Number
, String
, Symbol
, Bigint
, Date
, Map
, Set
, Promise
and RegExp
. Intrinsic Objects can alse be utility types like Math
or JSON
.
A Realm is a high level isolated execution environment. It's a record that consists of:
- Intrinsic objects,
- a Global Environment Record: composed of
- an Object Environment Record whose base object is the Global Object and
- a Declarative Environment Record.
- and a Global Object.
sec-completion-record-specification-type
Completion Record: A result of an internal javascript engine method. It contains
- a
[[Type]]
which can be of 5 different values:- normal: The operation completed successfully without any exceptional circumstances.
- throw: An exception was thrown.
- return: A return statement was encountered.
- break: A break statement was encountered.
- continue: A continue statement was encountered.
- an optional
[[Value]]
. It can contain a Specification Type or a Language Type.- In the case of a ThrowCompletionRecord, the value contains the exception object.
- an optional string
[[Target]]
used for the break and continue type to specify the label to jump to.
