Qortora · Search · Indexed page

tc39.esFetched 2026-09-01T06:56:10Z

ECMAScript® 2027 Language Specification

Introduction This Ecma Standard defines the ECMAScript 2027 Language. It is the eighteenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invente

Open original source · Full cached text

ECMAScript® 2027 Language Specification Pinsclear Table of Contents Introduction 1 Scope +2 Conformance2.1 Example Normative Optional Clause Heading 2.2 Example Legacy Clause Heading 2.3 Example Legacy Normative Optional Clause Heading 3 Normative References +4 Overview4.1 Web Scripting 4.2 Hosts and Implementations +4.3 ECMAScript Overview4.3.1 Objects 4.3.2 The Strict Variant of ECMAScript +4.4 Terms and Definitions4.4.1 implementation-approximated 4.4.2 implementation-defined 4.4.3 host-defined 4.4.4 type 4.4.5 primitive value 4.4.6 object 4.4.7 constructor 4.4.8 prototype 4.4.9 ordinary object 4.4.10 exotic object 4.4.11 standard object 4.4.12 built-in object 4.4.13 undefined value 4.4.14 Undefined type 4.4.15 null value 4.4.16 Null type 4.4.17 Boolean value 4.4.18 Boolean type 4.4.19 Boolean object 4.4.20 String value 4.4.21 String type 4.4.22 String object 4.4.23 Number value 4.4.24 Number type 4.4.25 Number object 4.4.26 Infinity 4.4.27 NaN 4.4.28 BigInt value 4.4.29 BigInt type 4.4.30 BigInt object 4.4.31 Symbol value 4.4.32 Symbol type 4.4.33 Symbol object 4.4.34 function 4.4.35 built-in function 4.4.36 built-in constructor 4.4.37 property 4.4.38 method 4.4.39 built-in method 4.4.40 attribute 4.4.41 own property 4.4.42 inherited property 4.5 Organization of This Specification +5 Notational Conventions+5.1 Syntactic and Lexical Grammars5.1.1 Context-Free Grammars 5.1.2 The Lexical and RegExp Grammars 5.1.3 The Numeric String Grammar 5.1.4 The Syntactic Grammar +5.1.5 Grammar Notation5.1.5.1 Terminal Symbols 5.1.5.2 Nonterminal Symbols and Productions 5.1.5.3 Optional Symbols 5.1.5.4 Grammatical Parameters 5.1.5.5 one of 5.1.5.6 [empty] 5.1.5.7 Lookahead Restrictions 5.1.5.8 [no LineTerminator here] 5.1.5.9 but not 5.1.5.10 Descriptive Phrases +5.2 Algorithm Conventions5.2.1 Evaluation Order 5.2.2 Abstract Operations 5.2.3 Syntax-Directed Operations +5.2.4 Runtime Semantics5.2.4.1 Completion ( completionRecord ) 5.2.4.2 Throw 5.2.4.3 Shorthands for Unwrapping Completion Records 5.2.4.4 Implicit Normal Completion 5.2.5 Static Semantics 5.2.6 Mathematical Operations 5.2.7 Value Notation 5.2.8 Identity +6 ECMAScript Data Types and Values+6.1 ECMAScript Language Types6.1.1 The Undefined Type 6.1.2 The Null Type 6.1.3 The Boolean Type +6.1.4 The String Type6.1.4.1 StringIndexOf ( string, searchValue, fromIndex ) 6.1.4.2 StringLastIndexOf ( string, searchValue, fromIndex ) +6.1.5 The Symbol Type6.1.5.1 Well-Known Symbols +6.1.6 Numeric Types+6.1.6.1 The Number Type6.1.6.1.1 Number::unaryMinus ( number ) 6.1.6.1.2 Number::bitwiseNOT ( number ) 6.1.6.1.3 Number::exponentiate ( base, exponent ) 6.1.6.1.4 Number::multiply ( x, y ) 6.1.6.1.5 Number::divide ( x, y ) 6.1.6.1.6 Number::remainder ( numerator, denominator ) 6.1.6.1.7 Number::add ( x, y ) 6.1.6.1.8 Number::subtract ( x, y ) 6.1.6.1.9 Number::leftShift ( x, y ) 6.1.6.1.10 Number::signedRightShift ( x, y ) 6.1.6.1.11 Number::unsignedRightShift ( x, y ) 6.1.6.1.12 Number::lessThan ( x, y ) 6.1.6.1.13 Number::equal ( x, y ) 6.1.6.1.14 Number::sameValue ( x, y ) 6.1.6.1.15 Number::sameValueZero ( x, y ) 6.1.6.1.16 NumberBitwiseOp ( op, x, y ) 6.1.6.1.17 Number::bitwiseAND ( x, y ) 6.1.6.1.18 Number::bitwiseXOR ( x, y ) 6.1.6.1.19 Number::bitwiseOR ( x, y ) 6.1.6.1.20 Number::toString ( x, radix ) +6.1.6.2 The BigInt Type6.1.6.2.1 BigInt::unaryMinus ( bigint ) 6.1.6.2.2 BigInt::bitwiseNOT ( bigint ) 6.1.6.2.3 BigInt::exponentiate ( base, exponent ) 6.1.6.2.4 BigInt::multiply ( x, y ) 6.1.6.2.5 BigInt::divide ( x, y ) 6.1.6.2.6 BigInt::remainder ( numerator, denominator ) 6.1.6.2.7 BigInt::add ( x, y ) 6.1.6.2.8 BigInt::subtract ( x, y ) 6.1.6.2.9 BigInt::leftShift ( x, y ) 6.1.6.2.10 BigInt::signedRightShift ( x, y ) 6.1.6.2.11 BigInt::unsignedRightShift ( x, y ) 6.1.6.2.12 BigInt::lessThan ( x, y ) 6.1.6.2.13 BigInt::equal ( x, y ) 6.1.6.2.14 BinaryAnd ( x, y ) 6.1.6.2.15 BinaryOr ( x, y ) 6.1.6.2.16 BinaryXor ( x, y ) 6.1.6.2.17 BigIntBitwiseOp ( op, x, y ) 6.1.6.2.18 BigInt::bitwiseAND ( x, y ) 6.1.6.2.19 BigInt::bitwiseXOR ( x, y ) 6.1.6.2.20 BigInt::bitwiseOR ( x, y ) 6.1.6.2.21 BigInt::toString ( x, radix ) +6.1.7 The Object Type6.1.7.1 Property Attributes 6.1.7.2 Object Internal Methods and Internal Slots 6.1.7.3 Invariants of the Essential Internal Methods 6.1.7.4 Well-Known Intrinsic Objects +6.2 ECMAScript Specification Types6.2.1 The Enum Specification Type 6.2.2 The List and Record Specification Types 6.2.3 The Set and Relation Specification Types +6.2.4 The Completion Record Specification Type6.2.4.1 NormalCompletion ( value ) 6.2.4.2 ThrowCompletion ( value ) 6.2.4.3 ReturnCompletion ( value ) 6.2.4.4 UpdateEmpty ( completionRecord, value ) +6.2.5 The Reference Record Specification Type6.2.5.1 IsPropertyReference ( refRecord ) 6.2.5.2 IsUnresolvableReference ( refRecord ) 6.2.5.3 IsSuperReference ( refRecord ) 6.2.5.4 IsPrivateReference ( refRecord ) 6.2.5.5 GetValue ( refRecord ) 6.2.5.6 PutValue ( refRecord, value ) 6.2.5.7 GetThisValue ( refRecord ) 6.2.5.8 InitializeReferencedBinding ( refRecord, value ) 6.2.5.9 MakePrivateReference ( baseValue, privateIdentifier ) +6.2.6 The Property Descriptor Specification Type6.2.6.1 IsAccessorDescriptor ( propertyDesc ) 6.2.6.2 IsDataDescriptor ( propertyDesc ) 6.2.6.3 IsGenericDescriptor ( propertyDesc ) 6.2.6.4 FromPropertyDescriptor ( propertyDesc ) 6.2.6.5 ToPropertyDescriptor ( obj ) 6.2.6.6 CompletePropertyDescriptor ( propertyDesc ) 6.2.7 The Environment Record Specification Type 6.2.8 The Abstract Closure Specification Type +6.2.9 Data Blocks6.2.9.1 CreateByteDataBlock ( size ) 6.2.9.2 CreateSharedByteDataBlock ( size ) 6.2.9.3 CopyDataBlockBytes ( toBlock, toIndex, fromBlock, fromIndex, count ) 6.2.10 The PrivateElement Specification Type 6.2.11 The ClassFieldDefinition Record Specification Type 6.2.12 Private Names 6.2.13 The ClassStaticBlockDefinition Record Specification Type +7 Abstract Operations+7.1 Type Conversion+7.1.1 ToPrimitive ( input [ , preferredType ] )7.1.1.1 OrdinaryToPrimitive ( obj, hint ) 7.1.2 ToBoolean ( arg ) 7.1.3 ToNumeric ( arg ) +7.1.4 ToNumber ( arg )+7.1.4.1 ToNumber Applied to the String Type7.1.4.1.1 StringToNumber ( string ) 7.1.4.1.2 RS: StringNumericValue 7.1.4.1.3 RoundMVResult ( n ) 7.1.5 ToIntegerOrInfinity ( arg ) 7.1.6 SnapToInteger ( arg, nonIntHandling [ , minimum [ , maximum ] ] ) 7.1.7 ToFixedSizeInteger ( int, signed, bitWidth ) 7.1.8 ToInt32 ( arg ) 7.1.9 ToUint32 ( arg ) 7.1.10 ToInt16 ( arg ) 7.1.11 ToUint16 ( arg ) 7.1.12 ToInt8 ( arg ) 7.1.13 ToUint8 ( arg ) 7.1.14 ToUint8Clamp ( arg ) 7.1.15 ToBigInt ( arg ) +7.1.16 StringToBigInt ( string )7.1.16.1 StringIntegerLiteral Grammar 7.1.16.2 RS: MV 7.1.17 ToBigInt64 ( arg ) 7.1.18 ToBigUint64 ( arg ) 7.1.19 ToString ( arg ) 7.1.20 ToObject ( arg ) 7.1.21 ToPropertyKey ( arg ) 7.1.22 ToLength ( arg ) 7.1.23 CanonicalNumericIndexString ( arg ) 7.1.24 ToIndex ( arg ) 7.1.25 ToAbsoluteIndex ( value, length ) 7.1.26 ToClampedIndex ( value, length ) +7.2 Testing and Comparison Operations7.2.1 RequireObjectCoercible ( arg ) 7.2.2 IsArray ( arg ) 7.2.3 IsCallable ( arg ) 7.2.4 IsConstructor ( arg ) 7.2.5 IsExtensible ( obj ) 7.2.6 IsRegExp ( arg ) 7.2.7 SS: IsStringWellFormedUnicode ( string ) 7.2.8 SameType ( x, y ) 7.2.9 SameValue ( x, y ) 7.2.10 SameValueZero ( x, y ) 7.2.11 SameValueNonNumber ( x, y ) 7.2.12 IsLessThan ( x, y, leftFirst ) 7.2.13 IsLooselyEqual ( x, y ) 7.2.14 IsStrictlyEqual ( x, y ) +7.3 Operations on Objects7.3.1 MakeBasicObject ( internalSlotsList ) 7.3.2 Get ( obj, propertyKey ) 7.3.3 GetV ( value, propertyKey ) 7.3.4 Set ( obj, propertyKey, value, throw ) 7.3.5 CreateDataProperty ( obj, propertyKey, value ) 7.3.6 CreateDataPropertyOrThrow ( obj, propertyKey, value ) 7.3.7 CreateNonEnumerableDataPropertyOrThrow ( obj, propertyKey, value ) 7.3.8 DefinePropertyOrThrow ( obj, propertyKey, propertyDesc ) 7.3.9 DeletePropertyOrThrow ( obj, propertyKey ) 7.3.10 GetMethod ( value, propertyKey ) 7.3.11 HasProperty ( obj, propertyKey ) 7.3.12 HasOwnProperty ( obj, propertyKey ) 7.3.13 Call ( func, thisValue [ , argList ] ) 7.3.14 Construct ( ctor [ , argList [ , newTarget ] ] ) 7.3.15 SetIntegrityLevel ( obj, level ) 7.3.16 TestIntegrityLevel ( obj, level ) 7.3.17 CreateArrayFromList ( elements ) 7.3.18 LengthOfArrayLike ( obj ) 7.3.19 CreateListFromArrayLike ( obj [ , validElementTypes ] ) 7.3.20 Invoke ( value, propertyKey [ , argList ] ) 7.3.21 OrdinaryHasInstance ( ctor, instance ) 7.3.22 SpeciesConstructor ( obj, defaultCtor ) 7.3.23 EnumerableOwnProperties ( obj, kind ) 7.3.24 GetFunctionRealm ( func ) 7.3.25 CopyDataProperties ( target, source, excludedItems ) 7.3.26 PrivateElementFind ( obj, privateName ) 7.3.27 PrivateFieldAdd ( obj, privateName, value ) 7.3.28 PrivateMethodOrAccessorAdd ( obj, method ) 7.3.29 HostEnsureCanAddPrivateElement ( obj ) 7.3.30 PrivateGet ( obj, privateName ) 7.3.31 PrivateSet ( obj, privateName, value ) 7.3.32 DefineField ( receiver, fieldRecord ) 7.3.33 InitializeInstanceElements ( obj, ctor ) 7.3.34 AddValueToKeyedGroup ( groups, key, value ) 7.3.35 GroupBy ( items, callback, keyCoercion ) 7.3.36 GetOptionsObject ( options ) 7.3.37 SetterThatIgnoresPrototypeProperties ( thisValue, home, propertyKey, value ) +7.4 Operations on Iterator Objects7.4.1 Iterator Records 7.4.2 GetIteratorDirect ( obj ) 7.4.3 GetIteratorFromMethod ( obj, method ) 7.4.4 GetIterator ( obj, kind ) 7.4.5 GetIteratorFlattenable ( obj, primitiveHandling ) 7.4.6 IteratorNext ( iteratorRecord [ , value ] ) 7.4.7 IteratorComplete ( iteratorResult ) 7.4.8 IteratorValue ( iteratorResult ) 7.4.9 IteratorStep ( iteratorRecord ) 7.4.10 IteratorStepValue ( iteratorRecord ) 7.4.11 IteratorClose ( iteratorRecord, completion ) 7.4.12 IteratorCloseAll ( iterators, completion ) 7.4.13 IfAbruptCloseIterator ( value, iteratorRecord ) 7.4.14 IfAbruptCloseIterators ( value, iteratorRecords ) 7.4.15 AsyncIteratorClose ( iteratorRecord, completion ) 7.4.16 IfAbruptCloseAsyncIterator ( value, iteratorRecord ) 7.4.17 CreateIteratorResultObject ( value, done ) 7.4.18 CreateListIteratorRecord ( list ) 7.4.19 IteratorToList ( iteratorRecord ) +7.5 Operations on Disposable Objects7.5.1 DisposableResource Records 7.5.2 AddDisposableResource ( disposableResourceStack, value, kind [ , method ] ) 7.5.3 CreateDisposableResource ( value, kind [ , method ] ) 7.5.4 GetDisposeMethod ( value, kind ) 7.5.5 DisposeResources ( disposableResourceStack, completion ) +8 Syntax-Directed Operations8.1 RS: Evaluation +8.2 Scope Analysis8.2.1 SS: BoundNames 8.2.2 SS: DeclarationPart 8.2.3 SS: IsConstantDeclaration 8.2.4 SS: IsUsingDeclaration 8.2.5 SS: IsAwaitUsingDeclaration 8.2.6 SS: LexicallyDeclaredNames 8.2.7 SS: LexicallyScopedDeclarations 8.2.8 SS: VarDeclaredNames 8.2.9 SS: VarScopedDeclarations 8.2.10 SS: TopLevelLexicallyDeclaredNames 8.2.11 SS: TopLevelLexicallyScopedDeclarations 8.2.12 SS: TopLevelVarDeclaredNames 8.2.13 SS: TopLevelVarScopedDeclarations +8.3 Labels8.3.1 SS: ContainsDuplicateLabels 8.3.2 SS: ContainsUndefinedBreakTarget 8.3.3 SS: ContainsUndefinedContinueTarget +8.4 Function Name Inference8.4.1 SS: HasName 8.4.2 SS: IsFunctionDefinition 8.4.3 SS: IsAnonymousFunctionDefinition ( expr ) 8.4.4 SS: IsIdentifierRef 8.4.5 RS: NamedEvaluation +8.5 Contains8.5.1 SS: Contains 8.5.2 SS: ComputedPropertyContains +8.6 Miscellaneous8.6.1 RS: InstantiateFunctionObject +8.6.2 RS: BindingInitialization8.6.2.1 InitializeBoundName ( name, value, envRecord ) 8.6.3 RS: IteratorBindingInitialization 8.6.4 SS: AssignmentTargetType 8.6.5 SS: PropName 8.6.6 SS: ContainsUsing +9 Executable Code and Execution Contexts+9.1 Environment Records+9.1.1 The Environment Record Type Hierarchy+9.1.1.1 Declarative Environment Records9.1.1.1.1 HasBinding ( name ) 9.1.1.1.2 CreateMutableBinding ( name, deletable ) 9.1.1.1.3 CreateImmutableBinding ( name, strict ) 9.1.1.1.4 InitializeBinding ( name, value ) 9.1.1.1.5 SetMutableBinding ( name, value, strict ) 9.1.1.1.6 GetBindingValue ( name, stri…