885
Reference number ECMA-123:2009 © Ecma International 2009 ECMA-262 8 th Edition / June 2017 ECMAScript ® 2017 Language Specification

ECMA-262 ECMAScript® 2016 Language Specification

Embed Size (px)

Citation preview

  • Reference number ECMA-123:2009

    Ecma International 2009

    ECMA-262 8th Edition / June 2017

    ECMAScript 2017 Language Specification

  • COPYRIGHT PROTECTED DOCUMENT

    Ecma International 2017

    Ecma International Rue du Rhone 114 CH-1204 Geneva Tel: +41 22 849 6000 Fax: +41 22 849 6001 Web: http://www.ecma-international.org

    http://www.ecma-international.org/

  • Ecma International 2017 i

    COPYRIGHT NOTICE

    2017 Ecma International

    This document may be copied, published and distributed to others, and certain derivative works of it may be prepared, copied, published, and distributed, in whole or in part, provided that the above copyright notice and this Copyright License and Disclaimer are included on al l such copies and derivative works. The only derivative works that are permissible under this Copyright License and Disclaimer are:

    (i) works which incorporate all or portion of this document for the purpose of providing commentary or explanation (such as an annotated version of the document),

    (ii) works which incorporate all or portion of this document for the purpose of incorporating features that provide accessibility,

    (iii) translations of this document into languages other than English and into differ ent formats and

    (iv) works by making use of this specification in standard conformant products by implementing (e.g. by copy and paste wholly or partly) the functionality therein.

    However, the content of this document itself may not be modified in any way, including by removing the copyright notice or references to Ecma International, except as required to translate it into languages other than English or into a different format.

    The official version of an Ecma International document is the English language version on the Ecma International website. In the event of discrepancies between a translated version and the official version, the official version shall govern.

    The limited permissions granted above are perpetual and will not be revoked by Ecma Internat ional or its successors or assigns.

    This document and the information contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."

    Software License

    All Software contained in this document ("Software)" is protected by copyright and is being made available under the "BSD

    License", included below. This Software may be subject to third party rights (rights from parties other than Ecma

    International), including patent rights, and no licenses under such third party rights are granted under this license even if

    the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT

    MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION

    REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL

    STANDARDS*.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following

    conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following

    disclaimer in the documentation and/or other materials provided with the distribution.

    3. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this

    software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED

    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE

    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES

    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,

    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN

    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    http://www.ecma-international.org/memento/codeofconduct.htm

  • ii Ecma International 2017

  • Introduction1Scope2Conformance3NormativeReferences4Overview4.1WebScripting4.2ECMAScriptOverview4.2.1Objects4.2.2TheStrictVariantofECMAScript

    4.3TermsandDeinitions4.3.1type4.3.2primitivevalue4.3.3object4.3.4constructor4.3.5prototype4.3.6ordinaryobject4.3.7exoticobject4.3.8standardobject4.3.9builtinobject4.3.10undeinedvalue4.3.11Undeinedtype4.3.12nullvalue4.3.13Nulltype4.3.14Booleanvalue4.3.15Booleantype4.3.16Booleanobject4.3.17Stringvalue4.3.18Stringtype4.3.19Stringobject4.3.20Numbervalue4.3.21Numbertype4.3.22Numberobject4.3.23Ininity

    ECMAScript2017LanguageSpeciicationTableofContents

  • 4.3.24NaN4.3.25Symbolvalue4.3.26Symboltype4.3.27Symbolobject4.3.28function4.3.29builtinfunction4.3.30property4.3.31method4.3.32builtinmethod4.3.33attribute4.3.34ownproperty4.3.35inheritedproperty

    4.4OrganizationofThisSpeciication5NotationalConventions5.1SyntacticandLexicalGrammars5.1.1ContextFreeGrammars5.1.2TheLexicalandRegExpGrammars5.1.3TheNumericStringGrammar5.1.4TheSyntacticGrammar5.1.5GrammarNotation

    5.2AlgorithmConventions5.3StaticSemanticRules

    6ECMAScriptDataTypesandValues6.1ECMAScriptLanguageTypes6.1.1TheUndeinedType6.1.2TheNullType6.1.3TheBooleanType6.1.4TheStringType6.1.5TheSymbolType6.1.5.1WellKnownSymbols

    6.1.6TheNumberType6.1.7TheObjectType6.1.7.1PropertyAttributes6.1.7.2ObjectInternalMethodsandInternalSlots6.1.7.3InvariantsoftheEssentialInternalMethods6.1.7.4WellKnownIntrinsicObjects

    6.2ECMAScriptSpeciicationTypes6.2.1TheListandRecordSpeciicationTypes6.2.2TheSetandRelationSpeciicationTypes6.2.3TheCompletionRecordSpeciicationType

  • 6.2.3.1NormalCompletion6.2.3.2ImplicitCompletionValues6.2.3.3ThrowanException6.2.3.4ReturnIfAbrupt6.2.3.5UpdateEmpty(completionRecord,value)

    6.2.4TheReferenceSpeciicationType6.2.4.1GetValue(V)6.2.4.2PutValue(V,W)6.2.4.3GetThisValue(V)6.2.4.4InitializeReferencedBinding(V,W)

    6.2.5ThePropertyDescriptorSpeciicationType6.2.5.1IsAccessorDescriptor(Desc)6.2.5.2IsDataDescriptor(Desc)6.2.5.3IsGenericDescriptor(Desc)6.2.5.4FromPropertyDescriptor(Desc)6.2.5.5ToPropertyDescriptor(Obj)6.2.5.6CompletePropertyDescriptor(Desc)

    6.2.6TheLexicalEnvironmentandEnvironmentRecordSpeciicationTypes6.2.7DataBlocks6.2.7.1CreateByteDataBlock(size)6.2.7.2CreateSharedByteDataBlock(size)6.2.7.3CopyDataBlockBytes(toBlock,toIndex,fromBlock,fromIndex,count)

    7AbstractOperations7.1TypeConversion7.1.1ToPrimitive(input[,PreferredType])7.1.1.1OrdinaryToPrimitive(O,hint)

    7.1.2ToBoolean(argument)7.1.3ToNumber(argument)7.1.3.1ToNumberAppliedtotheStringType7.1.3.1.1RS:MV

    7.1.4ToInteger(argument)7.1.5ToInt32(argument)7.1.6ToUint32(argument)7.1.7ToInt16(argument)7.1.8ToUint16(argument)7.1.9ToInt8(argument)7.1.10ToUint8(argument)7.1.11ToUint8Clamp(argument)7.1.12ToString(argument)7.1.12.1ToStringAppliedtotheNumberType

  • 7.1.13ToObject(argument)7.1.14ToPropertyKey(argument)7.1.15ToLength(argument)7.1.16CanonicalNumericIndexString(argument)7.1.17ToIndex(value)

    7.2TestingandComparisonOperations7.2.1RequireObjectCoercible(argument)7.2.2IsArray(argument)7.2.3IsCallable(argument)7.2.4IsConstructor(argument)7.2.5IsExtensible(O)7.2.6IsInteger(argument)7.2.7IsPropertyKey(argument)7.2.8IsRegExp(argument)7.2.9SameValue(x,y)7.2.10SameValueZero(x,y)7.2.11SameValueNonNumber(x,y)7.2.12AbstractRelationalComparison7.2.13AbstractEqualityComparison7.2.14StrictEqualityComparison

    7.3OperationsonObjects7.3.1Get(O,P)7.3.2GetV(V,P)7.3.3Set(O,P,V,Throw)7.3.4CreateDataProperty(O,P,V)7.3.5CreateMethodProperty(O,P,V)7.3.6CreateDataPropertyOrThrow(O,P,V)7.3.7DeinePropertyOrThrow(O,P,desc)7.3.8DeletePropertyOrThrow(O,P)7.3.9GetMethod(V,P)7.3.10HasProperty(O,P)7.3.11HasOwnProperty(O,P)7.3.12Call(F,V[,argumentsList])7.3.13Construct(F[,argumentsList[,newTarget]])7.3.14SetIntegrityLevel(O,level)7.3.15TestIntegrityLevel(O,level)7.3.16CreateArrayFromList(elements)7.3.17CreateListFromArrayLike(obj[,elementTypes])7.3.18Invoke(V,P[,argumentsList])7.3.19OrdinaryHasInstance(C,O)

  • 7.3.20SpeciesConstructor(O,defaultConstructor)7.3.21EnumerableOwnProperties(O,kind)7.3.22GetFunctionRealm(obj)

    7.4OperationsonIteratorObjects7.4.1GetIterator(obj[,method])7.4.2IteratorNext(iterator[,value])7.4.3IteratorComplete(iterResult)7.4.4IteratorValue(iterResult)7.4.5IteratorStep(iterator)7.4.6IteratorClose(iterator,completion)7.4.7CreateIterResultObject(value,done)7.4.8CreateListIterator(list)7.4.8.1ListIteratornext()

    8ExecutableCodeandExecutionContexts8.1LexicalEnvironments8.1.1EnvironmentRecords8.1.1.1DeclarativeEnvironmentRecords8.1.1.1.1HasBinding(N)8.1.1.1.2CreateMutableBinding(N,D)8.1.1.1.3CreateImmutableBinding(N,S)8.1.1.1.4InitializeBinding(N,V)8.1.1.1.5SetMutableBinding(N,V,S)8.1.1.1.6GetBindingValue(N,S)8.1.1.1.7DeleteBinding(N)8.1.1.1.8HasThisBinding()8.1.1.1.9HasSuperBinding()8.1.1.1.10WithBaseObject()

    8.1.1.2ObjectEnvironmentRecords8.1.1.2.1HasBinding(N)8.1.1.2.2CreateMutableBinding(N,D)8.1.1.2.3CreateImmutableBinding(N,S)8.1.1.2.4InitializeBinding(N,V)8.1.1.2.5SetMutableBinding(N,V,S)8.1.1.2.6GetBindingValue(N,S)8.1.1.2.7DeleteBinding(N)8.1.1.2.8HasThisBinding()8.1.1.2.9HasSuperBinding()8.1.1.2.10WithBaseObject()

    8.1.1.3FunctionEnvironmentRecords8.1.1.3.1BindThisValue(V)

  • 8.1.1.3.2HasThisBinding()8.1.1.3.3HasSuperBinding()8.1.1.3.4GetThisBinding()8.1.1.3.5GetSuperBase()

    8.1.1.4GlobalEnvironmentRecords8.1.1.4.1HasBinding(N)8.1.1.4.2CreateMutableBinding(N,D)8.1.1.4.3CreateImmutableBinding(N,S)8.1.1.4.4InitializeBinding(N,V)8.1.1.4.5SetMutableBinding(N,V,S)8.1.1.4.6GetBindingValue(N,S)8.1.1.4.7DeleteBinding(N)8.1.1.4.8HasThisBinding()8.1.1.4.9HasSuperBinding()8.1.1.4.10WithBaseObject()8.1.1.4.11GetThisBinding()8.1.1.4.12HasVarDeclaration(N)8.1.1.4.13HasLexicalDeclaration(N)8.1.1.4.14HasRestrictedGlobalProperty(N)8.1.1.4.15CanDeclareGlobalVar(N)8.1.1.4.16CanDeclareGlobalFunction(N)8.1.1.4.17CreateGlobalVarBinding(N,D)8.1.1.4.18CreateGlobalFunctionBinding(N,V,D)

    8.1.1.5ModuleEnvironmentRecords8.1.1.5.1GetBindingValue(N,S)8.1.1.5.2DeleteBinding(N)8.1.1.5.3HasThisBinding()8.1.1.5.4GetThisBinding()8.1.1.5.5CreateImportBinding(N,M,N2)

    8.1.2LexicalEnvironmentOperations8.1.2.1GetIdentiierReference(lex,name,strict)8.1.2.2NewDeclarativeEnvironment(E)8.1.2.3NewObjectEnvironment(O,E)8.1.2.4NewFunctionEnvironment(F,newTarget)8.1.2.5NewGlobalEnvironment(G,thisValue)8.1.2.6NewModuleEnvironment(E)

    8.2Realms8.2.1CreateRealm()8.2.2CreateIntrinsics(realmRec)8.2.3SetRealmGlobalObject(realmRec,globalObj,thisValue)

  • 8.2.4SetDefaultGlobalBindings(realmRec)8.3ExecutionContexts8.3.1GetActiveScriptOrModule()8.3.2ResolveBinding(name[,env])8.3.3GetThisEnvironment()8.3.4ResolveThisBinding()8.3.5GetNewTarget()8.3.6GetGlobalObject()

    8.4JobsandJobQueues8.4.1EnqueueJob(queueName,job,arguments)

    8.5InitializeHostDeinedRealm()8.6RunJobs()8.7Agents8.7.1AgentSigniier()8.7.2AgentCanSuspend()

    8.8AgentClusters8.9ForwardProgress

    9OrdinaryandExoticObjectsBehaviours9.1OrdinaryObjectInternalMethodsandInternalSlots9.1.1[[GetPrototypeOf]]()9.1.1.1OrdinaryGetPrototypeOf(O)

    9.1.2[[SetPrototypeOf]](V)9.1.2.1OrdinarySetPrototypeOf(O,V)

    9.1.3[[IsExtensible]]()9.1.3.1OrdinaryIsExtensible(O)

    9.1.4[[PreventExtensions]]()9.1.4.1OrdinaryPreventExtensions(O)

    9.1.5[[GetOwnProperty]](P)9.1.5.1OrdinaryGetOwnProperty(O,P)

    9.1.6[[DeineOwnProperty]](P,Desc)9.1.6.1OrdinaryDeineOwnProperty(O,P,Desc)9.1.6.2IsCompatiblePropertyDescriptor(Extensible,Desc,Current)9.1.6.3ValidateAndApplyPropertyDescriptor(O,P,extensible,Desc,current)

    9.1.7[[HasProperty]](P)9.1.7.1OrdinaryHasProperty(O,P)

    9.1.8[[Get]](P,Receiver)9.1.8.1OrdinaryGet(O,P,Receiver)

    9.1.9[[Set]](P,V,Receiver)9.1.9.1OrdinarySet(O,P,V,Receiver)

    9.1.10[[Delete]](P)

  • 9.1.10.1OrdinaryDelete(O,P)9.1.11[[OwnPropertyKeys]]()9.1.11.1OrdinaryOwnPropertyKeys(O)

    9.1.12ObjectCreate(proto[,internalSlotsList])9.1.13OrdinaryCreateFromConstructor(constructor,intrinsicDefaultProto[,internalSlotsList])9.1.14GetPrototypeFromConstructor(constructor,intrinsicDefaultProto)

    9.2ECMAScriptFunctionObjects9.2.1[[Call]](thisArgument,argumentsList)9.2.1.1PrepareForOrdinaryCall(F,newTarget)9.2.1.2OrdinaryCallBindThis(F,calleeContext,thisArgument)9.2.1.3OrdinaryCallEvaluateBody(F,argumentsList)

    9.2.2[[Construct]](argumentsList,newTarget)9.2.3FunctionAllocate(functionPrototype,strict,functionKind)9.2.4FunctionInitialize(F,kind,ParameterList,Body,Scope)9.2.5FunctionCreate(kind,ParameterList,Body,Scope,Strict[,prototype])9.2.6GeneratorFunctionCreate(kind,ParameterList,Body,Scope,Strict)9.2.7AddRestrictedFunctionProperties(F,realm)9.2.7.1%ThrowTypeError%()

    9.2.8MakeConstructor(F[,writablePrototype[,prototype]])9.2.9MakeClassConstructor(F)9.2.10MakeMethod(F,homeObject)9.2.11SetFunctionName(F,name[,preix])9.2.12FunctionDeclarationInstantiation(func,argumentsList)

    9.3BuiltinFunctionObjects9.3.1[[Call]](thisArgument,argumentsList)9.3.2[[Construct]](argumentsList,newTarget)9.3.3CreateBuiltinFunction(realm,steps,prototype[,internalSlotsList])

    9.4BuiltinExoticObjectInternalMethodsandSlots9.4.1BoundFunctionExoticObjects9.4.1.1[[Call]](thisArgument,argumentsList)9.4.1.2[[Construct]](argumentsList,newTarget)9.4.1.3BoundFunctionCreate(targetFunction,boundThis,boundArgs)

    9.4.2ArrayExoticObjects9.4.2.1[[DeineOwnProperty]](P,Desc)9.4.2.2ArrayCreate(length[,proto])9.4.2.3ArraySpeciesCreate(originalArray,length)9.4.2.4ArraySetLength(A,Desc)

    9.4.3StringExoticObjects9.4.3.1[[GetOwnProperty]](P)9.4.3.2[[DeineOwnProperty]](P,Desc)

  • 9.4.3.3[[OwnPropertyKeys]]()9.4.3.4StringCreate(value,prototype)9.4.3.5StringGetOwnProperty(S,P)

    9.4.4ArgumentsExoticObjects9.4.4.1[[GetOwnProperty]](P)9.4.4.2[[DeineOwnProperty]](P,Desc)9.4.4.3[[Get]](P,Receiver)9.4.4.4[[Set]](P,V,Receiver)9.4.4.5[[Delete]](P)9.4.4.6CreateUnmappedArgumentsObject(argumentsList)9.4.4.7CreateMappedArgumentsObject(func,formals,argumentsList,env)9.4.4.7.1MakeArgGetter(name,env)9.4.4.7.2MakeArgSetter(name,env)

    9.4.5IntegerIndexedExoticObjects9.4.5.1[[GetOwnProperty]](P)9.4.5.2[[HasProperty]](P)9.4.5.3[[DeineOwnProperty]](P,Desc)9.4.5.4[[Get]](P,Receiver)9.4.5.5[[Set]](P,V,Receiver)9.4.5.6[[OwnPropertyKeys]]()9.4.5.7IntegerIndexedObjectCreate(prototype,internalSlotsList)9.4.5.8IntegerIndexedElementGet(O,index)9.4.5.9IntegerIndexedElementSet(O,index,value)

    9.4.6ModuleNamespaceExoticObjects9.4.6.1[[SetPrototypeOf]](V)9.4.6.2[[IsExtensible]]()9.4.6.3[[PreventExtensions]]()9.4.6.4[[GetOwnProperty]](P)9.4.6.5[[DeineOwnProperty]](P,Desc)9.4.6.6[[HasProperty]](P)9.4.6.7[[Get]](P,Receiver)9.4.6.8[[Set]](P,V,Receiver)9.4.6.9[[Delete]](P)9.4.6.10[[OwnPropertyKeys]]()9.4.6.11ModuleNamespaceCreate(module,exports)

    9.4.7ImmutablePrototypeExoticObjects9.4.7.1[[SetPrototypeOf]](V)9.4.7.2SetImmutablePrototype(O,V)

    9.5ProxyObjectInternalMethodsandInternalSlots9.5.1[[GetPrototypeOf]]()

  • 9.5.2[[SetPrototypeOf]](V)9.5.3[[IsExtensible]]()9.5.4[[PreventExtensions]]()9.5.5[[GetOwnProperty]](P)9.5.6[[DeineOwnProperty]](P,Desc)9.5.7[[HasProperty]](P)9.5.8[[Get]](P,Receiver)9.5.9[[Set]](P,V,Receiver)9.5.10[[Delete]](P)9.5.11[[OwnPropertyKeys]]()9.5.12[[Call]](thisArgument,argumentsList)9.5.13[[Construct]](argumentsList,newTarget)9.5.14ProxyCreate(target,handler)

    10ECMAScriptLanguage:SourceCode10.1SourceText10.1.1SS:UTF16Encoding(cp)10.1.2SS:UTF16Decode(lead,trail)

    10.2TypesofSourceCode10.2.1StrictModeCode10.2.2NonECMAScriptFunctions

    11ECMAScriptLanguage:LexicalGrammar11.1UnicodeFormatControlCharacters11.2WhiteSpace11.3LineTerminators11.4Comments11.5Tokens11.6NamesandKeywords11.6.1IdentiierNames11.6.1.1SS:EarlyErrors11.6.1.2SS:StringValue

    11.6.2ReservedWords11.6.2.1Keywords11.6.2.2FutureReservedWords

    11.7Punctuators11.8Literals11.8.1NullLiterals11.8.2BooleanLiterals11.8.3NumericLiterals11.8.3.1SS:MV

    11.8.4StringLiterals

  • 11.8.4.1SS:EarlyErrors11.8.4.2SS:StringValue11.8.4.3SS:SV

    11.8.5RegularExpressionLiterals11.8.5.1SS:EarlyErrors11.8.5.2SS:BodyText11.8.5.3SS:FlagText

    11.8.6TemplateLiteralLexicalComponents11.8.6.1SS:TVandTRV

    11.9AutomaticSemicolonInsertion11.9.1RulesofAutomaticSemicolonInsertion11.9.2ExamplesofAutomaticSemicolonInsertion

    12ECMAScriptLanguage:Expressions12.1Identiiers12.1.1SS:EarlyErrors12.1.2SS:BoundNames12.1.3SS:IsValidSimpleAssignmentTarget12.1.4SS:StringValue12.1.5RS:BindingInitialization12.1.5.1RS:InitializeBoundName(name,value,environment)

    12.1.6RS:Evaluation12.2PrimaryExpression12.2.1Semantics12.2.1.1SS:CoveredParenthesizedExpression12.2.1.2SS:HasName12.2.1.3SS:IsFunctionDeinition12.2.1.4SS:IsIdentiierRef12.2.1.5SS:IsValidSimpleAssignmentTarget

    12.2.2ThethisKeyword12.2.2.1RS:Evaluation

    12.2.3IdentiierReference12.2.4Literals12.2.4.1RS:Evaluation

    12.2.5ArrayInitializer12.2.5.1SS:ElisionWidth12.2.5.2RS:ArrayAccumulation12.2.5.3RS:Evaluation

    12.2.6ObjectInitializer12.2.6.1SS:EarlyErrors12.2.6.2SS:ComputedPropertyContains

  • 12.2.6.3SS:Contains12.2.6.4SS:IsComputedPropertyKey12.2.6.5SS:PropName12.2.6.6SS:PropertyNameList12.2.6.7RS:Evaluation12.2.6.8RS:PropertyDeinitionEvaluation

    12.2.7FunctionDeiningExpressions12.2.8RegularExpressionLiterals12.2.8.1SS:EarlyErrors12.2.8.2RS:Evaluation

    12.2.9TemplateLiterals12.2.9.1SS:TemplateStrings12.2.9.2RS:ArgumentListEvaluation12.2.9.3RS:GetTemplateObject(templateLiteral)12.2.9.4RS:SubstitutionEvaluation12.2.9.5RS:Evaluation

    12.2.10TheGroupingOperator12.2.10.1SS:EarlyErrors12.2.10.2SS:IsFunctionDeinition12.2.10.3SS:IsValidSimpleAssignmentTarget12.2.10.4RS:Evaluation

    12.3LeftHandSideExpressions12.3.1StaticSemantics12.3.1.1SS:CoveredCallExpression12.3.1.2SS:Contains12.3.1.3SS:IsFunctionDeinition12.3.1.4SS:IsDestructuring12.3.1.5SS:IsIdentiierRef12.3.1.6SS:IsValidSimpleAssignmentTarget

    12.3.2PropertyAccessors12.3.2.1RS:Evaluation

    12.3.3ThenewOperator12.3.3.1RS:Evaluation12.3.3.1.1RS:EvaluateNew(constructExpr,arguments)

    12.3.4FunctionCalls12.3.4.1RS:Evaluation12.3.4.2RS:EvaluateCall(ref,arguments,tailPosition)12.3.4.3RS:EvaluateDirectCall(func,thisValue,arguments,tailPosition)

    12.3.5ThesuperKeyword12.3.5.1RS:Evaluation

  • 12.3.5.2RS:GetSuperConstructor()12.3.5.3RS:MakeSuperPropertyReference(propertyKey,strict)

    12.3.6ArgumentLists12.3.6.1RS:ArgumentListEvaluation

    12.3.7TaggedTemplates12.3.7.1RS:Evaluation

    12.3.8MetaProperties12.3.8.1RS:Evaluation

    12.4UpdateExpressions12.4.1SS:EarlyErrors12.4.2SS:IsFunctionDeinition12.4.3SS:IsValidSimpleAssignmentTarget12.4.4PostixIncrementOperator12.4.4.1RS:Evaluation

    12.4.5PostixDecrementOperator12.4.5.1RS:Evaluation

    12.4.6PreixIncrementOperator12.4.6.1RS:Evaluation

    12.4.7PreixDecrementOperator12.4.7.1RS:Evaluation

    12.5UnaryOperators12.5.1SS:IsFunctionDeinition12.5.2SS:IsValidSimpleAssignmentTarget12.5.3ThedeleteOperator12.5.3.1SS:EarlyErrors12.5.3.2RS:Evaluation

    12.5.4ThevoidOperator12.5.4.1RS:Evaluation

    12.5.5ThetypeofOperator12.5.5.1RS:Evaluation

    12.5.6Unary+Operator12.5.6.1RS:Evaluation

    12.5.7UnaryOperator12.5.7.1RS:Evaluation

    12.5.8BitwiseNOTOperator(~)12.5.8.1RS:Evaluation

    12.5.9LogicalNOTOperator(!)12.5.9.1RS:Evaluation

    12.6ExponentiationOperator12.6.1SS:IsFunctionDeinition

  • 12.6.2SS:IsValidSimpleAssignmentTarget12.6.3RS:Evaluation12.6.4Applyingthe**Operator

    12.7MultiplicativeOperators12.7.1SS:IsFunctionDeinition12.7.2SS:IsValidSimpleAssignmentTarget12.7.3RS:Evaluation12.7.3.1Applyingthe*Operator12.7.3.2Applyingthe/Operator12.7.3.3Applyingthe%Operator

    12.8AdditiveOperators12.8.1SS:IsFunctionDeinition12.8.2SS:IsValidSimpleAssignmentTarget12.8.3TheAdditionOperator(+)12.8.3.1RS:Evaluation

    12.8.4TheSubtractionOperator()12.8.4.1RS:Evaluation

    12.8.5ApplyingtheAdditiveOperatorstoNumbers12.9BitwiseShiftOperators12.9.1SS:IsFunctionDeinition12.9.2SS:IsValidSimpleAssignmentTarget12.9.3TheLeftShiftOperator()12.9.4.1RS:Evaluation

    12.9.5TheUnsignedRightShiftOperator(>>>)12.9.5.1RS:Evaluation

    12.10RelationalOperators12.10.1SS:IsFunctionDeinition12.10.2SS:IsValidSimpleAssignmentTarget12.10.3RS:Evaluation12.10.4RS:InstanceofOperator(O,C)

    12.11EqualityOperators12.11.1SS:IsFunctionDeinition12.11.2SS:IsValidSimpleAssignmentTarget12.11.3RS:Evaluation

    12.12BinaryBitwiseOperators12.12.1SS:IsFunctionDeinition12.12.2SS:IsValidSimpleAssignmentTarget12.12.3RS:Evaluation

  • 12.13BinaryLogicalOperators12.13.1SS:IsFunctionDeinition12.13.2SS:IsValidSimpleAssignmentTarget12.13.3RS:Evaluation

    12.14ConditionalOperator(?:)12.14.1SS:IsFunctionDeinition12.14.2SS:IsValidSimpleAssignmentTarget12.14.3RS:Evaluation

    12.15AssignmentOperators12.15.1SS:EarlyErrors12.15.2SS:IsFunctionDeinition12.15.3SS:IsValidSimpleAssignmentTarget12.15.4RS:Evaluation12.15.5DestructuringAssignment12.15.5.1SS:EarlyErrors12.15.5.2RS:DestructuringAssignmentEvaluation12.15.5.3RS:IteratorDestructuringAssignmentEvaluation12.15.5.4RS:KeyedDestructuringAssignmentEvaluation

    12.16CommaOperator(,)12.16.1SS:IsFunctionDeinition12.16.2SS:IsValidSimpleAssignmentTarget12.16.3RS:Evaluation

    13ECMAScriptLanguage:StatementsandDeclarations13.1StatementSemantics13.1.1SS:ContainsDuplicateLabels13.1.2SS:ContainsUndeinedBreakTarget13.1.3SS:ContainsUndeinedContinueTarget13.1.4SS:DeclarationPart13.1.5SS:VarDeclaredNames13.1.6SS:VarScopedDeclarations13.1.7RS:LabelledEvaluation13.1.8RS:Evaluation

    13.2Block13.2.1SS:EarlyErrors13.2.2SS:ContainsDuplicateLabels13.2.3SS:ContainsUndeinedBreakTarget13.2.4SS:ContainsUndeinedContinueTarget13.2.5SS:LexicallyDeclaredNames13.2.6SS:LexicallyScopedDeclarations13.2.7SS:TopLevelLexicallyDeclaredNames

  • 13.2.8SS:TopLevelLexicallyScopedDeclarations13.2.9SS:TopLevelVarDeclaredNames13.2.10SS:TopLevelVarScopedDeclarations13.2.11SS:VarDeclaredNames13.2.12SS:VarScopedDeclarations13.2.13RS:Evaluation13.2.14RS:BlockDeclarationInstantiation(code,env)

    13.3DeclarationsandtheVariableStatement13.3.1LetandConstDeclarations13.3.1.1SS:EarlyErrors13.3.1.2SS:BoundNames13.3.1.3SS:IsConstantDeclaration13.3.1.4RS:Evaluation

    13.3.2VariableStatement13.3.2.1SS:BoundNames13.3.2.2SS:VarDeclaredNames13.3.2.3SS:VarScopedDeclarations13.3.2.4RS:Evaluation

    13.3.3DestructuringBindingPatterns13.3.3.1SS:BoundNames13.3.3.2SS:ContainsExpression13.3.3.3SS:HasInitializer13.3.3.4SS:IsSimpleParameterList13.3.3.5RS:BindingInitialization13.3.3.6RS:IteratorBindingInitialization13.3.3.7RS:KeyedBindingInitialization

    13.4EmptyStatement13.4.1RS:Evaluation

    13.5ExpressionStatement13.5.1RS:Evaluation

    13.6TheifStatement13.6.1SS:EarlyErrors13.6.2SS:ContainsDuplicateLabels13.6.3SS:ContainsUndeinedBreakTarget13.6.4SS:ContainsUndeinedContinueTarget13.6.5SS:VarDeclaredNames13.6.6SS:VarScopedDeclarations13.6.7RS:Evaluation

    13.7IterationStatements13.7.1Semantics

  • 13.7.1.1SS:EarlyErrors13.7.1.2RS:LoopContinues(completion,labelSet)

    13.7.2ThedowhileStatement13.7.2.1SS:ContainsDuplicateLabels13.7.2.2SS:ContainsUndeinedBreakTarget13.7.2.3SS:ContainsUndeinedContinueTarget13.7.2.4SS:VarDeclaredNames13.7.2.5SS:VarScopedDeclarations13.7.2.6RS:LabelledEvaluation

    13.7.3ThewhileStatement13.7.3.1SS:ContainsDuplicateLabels13.7.3.2SS:ContainsUndeinedBreakTarget13.7.3.3SS:ContainsUndeinedContinueTarget13.7.3.4SS:VarDeclaredNames13.7.3.5SS:VarScopedDeclarations13.7.3.6RS:LabelledEvaluation

    13.7.4TheforStatement13.7.4.1SS:EarlyErrors13.7.4.2SS:ContainsDuplicateLabels13.7.4.3SS:ContainsUndeinedBreakTarget13.7.4.4SS:ContainsUndeinedContinueTarget13.7.4.5SS:VarDeclaredNames13.7.4.6SS:VarScopedDeclarations13.7.4.7RS:LabelledEvaluation13.7.4.8RS:ForBodyEvaluation(test,increment,stmt,perIterationBindings,labelSet)13.7.4.9RS:CreatePerIterationEnvironment(perIterationBindings)

    13.7.5TheforinandforofStatements13.7.5.1SS:EarlyErrors13.7.5.2SS:BoundNames13.7.5.3SS:ContainsDuplicateLabels13.7.5.4SS:ContainsUndeinedBreakTarget13.7.5.5SS:ContainsUndeinedContinueTarget13.7.5.6SS:IsDestructuring13.7.5.7SS:VarDeclaredNames13.7.5.8SS:VarScopedDeclarations13.7.5.9RS:BindingInitialization13.7.5.10RS:BindingInstantiation13.7.5.11RS:LabelledEvaluation13.7.5.12RS:ForIn/OfHeadEvaluation(TDZnames,expr,iterationKind)13.7.5.13RS:ForIn/OfBodyEvaluation(lhs,stmt,iterator,iterationKind,lhsKind,labelSet)

  • 13.7.5.14RS:Evaluation13.7.5.15EnumerateObjectProperties(O)

    13.8ThecontinueStatement13.8.1SS:EarlyErrors13.8.2SS:ContainsUndeinedContinueTarget13.8.3RS:Evaluation

    13.9ThebreakStatement13.9.1SS:EarlyErrors13.9.2SS:ContainsUndeinedBreakTarget13.9.3RS:Evaluation

    13.10ThereturnStatement13.10.1RS:Evaluation

    13.11ThewithStatement13.11.1SS:EarlyErrors13.11.2SS:ContainsDuplicateLabels13.11.3SS:ContainsUndeinedBreakTarget13.11.4SS:ContainsUndeinedContinueTarget13.11.5SS:VarDeclaredNames13.11.6SS:VarScopedDeclarations13.11.7RS:Evaluation

    13.12TheswitchStatement13.12.1SS:EarlyErrors13.12.2SS:ContainsDuplicateLabels13.12.3SS:ContainsUndeinedBreakTarget13.12.4SS:ContainsUndeinedContinueTarget13.12.5SS:LexicallyDeclaredNames13.12.6SS:LexicallyScopedDeclarations13.12.7SS:VarDeclaredNames13.12.8SS:VarScopedDeclarations13.12.9RS:CaseBlockEvaluation13.12.10RS:CaseSelectorEvaluation13.12.11RS:Evaluation

    13.13LabelledStatements13.13.1SS:EarlyErrors13.13.2SS:ContainsDuplicateLabels13.13.3SS:ContainsUndeinedBreakTarget13.13.4SS:ContainsUndeinedContinueTarget13.13.5SS:IsLabelledFunction(stmt)13.13.6SS:LexicallyDeclaredNames13.13.7SS:LexicallyScopedDeclarations

  • 13.13.8SS:TopLevelLexicallyDeclaredNames13.13.9SS:TopLevelLexicallyScopedDeclarations13.13.10SS:TopLevelVarDeclaredNames13.13.11SS:TopLevelVarScopedDeclarations13.13.12SS:VarDeclaredNames13.13.13SS:VarScopedDeclarations13.13.14RS:LabelledEvaluation13.13.15RS:Evaluation

    13.14ThethrowStatement13.14.1RS:Evaluation

    13.15ThetryStatement13.15.1SS:EarlyErrors13.15.2SS:ContainsDuplicateLabels13.15.3SS:ContainsUndeinedBreakTarget13.15.4SS:ContainsUndeinedContinueTarget13.15.5SS:VarDeclaredNames13.15.6SS:VarScopedDeclarations13.15.7RS:CatchClauseEvaluation13.15.8RS:Evaluation

    13.16ThedebuggerStatement13.16.1RS:Evaluation

    14ECMAScriptLanguage:FunctionsandClasses14.1FunctionDeinitions14.1.1DirectiveProloguesandtheUseStrictDirective14.1.2SS:EarlyErrors14.1.3SS:BoundNames14.1.4SS:Contains14.1.5SS:ContainsExpression14.1.6SS:ContainsUseStrict14.1.7SS:ExpectedArgumentCount14.1.8SS:HasInitializer14.1.9SS:HasName14.1.10SS:IsAnonymousFunctionDeinition(expr)14.1.11SS:IsConstantDeclaration14.1.12SS:IsFunctionDeinition14.1.13SS:IsSimpleParameterList14.1.14SS:LexicallyDeclaredNames14.1.15SS:LexicallyScopedDeclarations14.1.16SS:VarDeclaredNames14.1.17SS:VarScopedDeclarations

  • 14.1.18RS:EvaluateBody14.1.19RS:IteratorBindingInitialization14.1.20RS:InstantiateFunctionObject14.1.21RS:Evaluation

    14.2ArrowFunctionDeinitions14.2.1SS:EarlyErrors14.2.2SS:BoundNames14.2.3SS:Contains14.2.4SS:ContainsExpression14.2.5SS:ContainsUseStrict14.2.6SS:ExpectedArgumentCount14.2.7SS:HasName14.2.8SS:IsSimpleParameterList14.2.9SS:CoveredFormalsList14.2.10SS:LexicallyDeclaredNames14.2.11SS:LexicallyScopedDeclarations14.2.12SS:VarDeclaredNames14.2.13SS:VarScopedDeclarations14.2.14RS:IteratorBindingInitialization14.2.15RS:EvaluateBody14.2.16RS:Evaluation

    14.3MethodDeinitions14.3.1SS:EarlyErrors14.3.2SS:ComputedPropertyContains14.3.3SS:ExpectedArgumentCount14.3.4SS:HasDirectSuper14.3.5SS:PropName14.3.6SS:SpecialMethod14.3.7RS:DeineMethod14.3.8RS:PropertyDeinitionEvaluation

    14.4GeneratorFunctionDeinitions14.4.1SS:EarlyErrors14.4.2SS:BoundNames14.4.3SS:ComputedPropertyContains14.4.4SS:Contains14.4.5SS:HasDirectSuper14.4.6SS:HasName14.4.7SS:IsConstantDeclaration14.4.8SS:IsFunctionDeinition14.4.9SS:PropName

  • 14.4.10RS:EvaluateBody14.4.11RS:InstantiateFunctionObject14.4.12RS:PropertyDeinitionEvaluation14.4.13RS:Evaluation

    14.5ClassDeinitions14.5.1SS:EarlyErrors14.5.2SS:BoundNames14.5.3SS:ConstructorMethod14.5.4SS:Contains14.5.5SS:ComputedPropertyContains14.5.6SS:HasName14.5.7SS:IsConstantDeclaration14.5.8SS:IsFunctionDeinition14.5.9SS:IsStatic14.5.10SS:NonConstructorMethodDeinitions14.5.11SS:PrototypePropertyNameList14.5.12SS:PropName14.5.13RS:ClassDeinitionEvaluation14.5.14RS:BindingClassDeclarationEvaluation14.5.15RS:Evaluation

    14.6AsyncFunctionDeinitions14.6.1SS:EarlyErrors14.6.2SS:BoundNames14.6.3SS:ComputedPropertyContains14.6.4SS:Contains14.6.5SS:HasDirectSuper14.6.6SS:HasName14.6.7SS:IsConstantDeclaration14.6.8SS:IsFunctionDeinition14.6.9SS:PropName14.6.10RS:InstantiateFunctionObject14.6.11RS:EvaluateBody14.6.12RS:PropertyDeinitionEvaluation14.6.13RS:Evaluation

    14.7AsyncArrowFunctionDeinitions14.7.1SS:EarlyErrors14.7.2SS:CoveredAsyncArrowHead14.7.3SS:BoundNames14.7.4SS:Contains14.7.5SS:ContainsExpression

  • 14.7.6SS:ExpectedArgumentCount14.7.7SS:HasName14.7.8SS:IsSimpleParameterList14.7.9SS:LexicallyDeclaredNames14.7.10SS:LexicallyScopedDeclarations14.7.11SS:VarDeclaredNames14.7.12SS:VarScopedDeclarations14.7.13RS:IteratorBindingInitialization14.7.14RS:EvaluateBody14.7.15RS:Evaluation

    14.8TailPositionCalls14.8.1SS:IsInTailPosition(call)14.8.2SS:HasCallInTailPosition14.8.2.1StatementRules14.8.2.2ExpressionRules

    14.8.3RS:PrepareForTailCall()15ECMAScriptLanguage:ScriptsandModules15.1Scripts15.1.1SS:EarlyErrors15.1.2SS:IsStrict15.1.3SS:LexicallyDeclaredNames15.1.4SS:LexicallyScopedDeclarations15.1.5SS:VarDeclaredNames15.1.6SS:VarScopedDeclarations15.1.7RS:Evaluation15.1.8ScriptRecords15.1.9ParseScript(sourceText,realm,hostDeined)15.1.10ScriptEvaluation(scriptRecord)15.1.11RS:GlobalDeclarationInstantiation(script,env)15.1.12RS:ScriptEvaluationJob(sourceText,hostDeined)

    15.2Modules15.2.1ModuleSemantics15.2.1.1SS:EarlyErrors15.2.1.2SS:ContainsDuplicateLabels15.2.1.3SS:ContainsUndeinedBreakTarget15.2.1.4SS:ContainsUndeinedContinueTarget15.2.1.5SS:ExportedBindings15.2.1.6SS:ExportedNames15.2.1.7SS:ExportEntries15.2.1.8SS:ImportEntries

  • 15.2.1.9SS:ImportedLocalNames(importEntries)15.2.1.10SS:ModuleRequests15.2.1.11SS:LexicallyDeclaredNames15.2.1.12SS:LexicallyScopedDeclarations15.2.1.13SS:VarDeclaredNames15.2.1.14SS:VarScopedDeclarations15.2.1.15AbstractModuleRecords15.2.1.16SourceTextModuleRecords15.2.1.16.1ParseModule(sourceText,realm,hostDeined)15.2.1.16.2GetExportedNames(exportStarSet)ConcreteMethod15.2.1.16.3ResolveExport(exportName,resolveSet)ConcreteMethod15.2.1.16.4ModuleDeclarationInstantiation()ConcreteMethod15.2.1.16.5ModuleEvaluation()ConcreteMethod

    15.2.1.17RS:HostResolveImportedModule(referencingModule,speciier)15.2.1.18RS:GetModuleNamespace(module)15.2.1.19RS:TopLevelModuleEvaluationJob(sourceText,hostDeined)15.2.1.20RS:Evaluation

    15.2.2Imports15.2.2.1SS:EarlyErrors15.2.2.2SS:BoundNames15.2.2.3SS:ImportEntries15.2.2.4SS:ImportEntriesForModule15.2.2.5SS:ModuleRequests

    15.2.3Exports15.2.3.1SS:EarlyErrors15.2.3.2SS:BoundNames15.2.3.3SS:ExportedBindings15.2.3.4SS:ExportedNames15.2.3.5SS:ExportEntries15.2.3.6SS:ExportEntriesForModule15.2.3.7SS:IsConstantDeclaration15.2.3.8SS:LexicallyScopedDeclarations15.2.3.9SS:ModuleRequests15.2.3.10SS:ReferencedBindings15.2.3.11RS:Evaluation

    16ErrorHandlingandLanguageExtensions16.1HostReportErrors(errorList)16.2ForbiddenExtensions

    17ECMAScriptStandardBuiltinObjects18TheGlobalObject

  • 18.1ValuePropertiesoftheGlobalObject18.1.1Ininity18.1.2NaN18.1.3undeined

    18.2FunctionPropertiesoftheGlobalObject18.2.1eval(x)18.2.1.1RS:PerformEval(x,evalRealm,strictCaller,direct)18.2.1.1.1AdditionalEarlyErrorRulesforEvalOutsideFunctions18.2.1.1.2AdditionalEarlyErrorRulesforEvalOutsideMethods18.2.1.1.3AdditionalEarlyErrorRulesforEvalOutsideConstructorMethods

    18.2.1.2HostEnsureCanCompileStrings(callerRealm,calleeRealm)18.2.1.3RS:EvalDeclarationInstantiation(body,varEnv,lexEnv,strict)

    18.2.2isFinite(number)18.2.3isNaN(number)18.2.4parseFloat(string)18.2.5parseInt(string,radix)18.2.6URIHandlingFunctions18.2.6.1URISyntaxandSemantics18.2.6.1.1RS:Encode(string,unescapedSet)18.2.6.1.2RS:Decode(string,reservedSet)

    18.2.6.2decodeURI(encodedURI)18.2.6.3decodeURIComponent(encodedURIComponent)18.2.6.4encodeURI(uri)18.2.6.5encodeURIComponent(uriComponent)

    18.3ConstructorPropertiesoftheGlobalObject18.3.1Array(...)18.3.2ArrayBuffer(...)18.3.3Boolean(...)18.3.4DataView(...)18.3.5Date(...)18.3.6Error(...)18.3.7EvalError(...)18.3.8Float32Array(...)18.3.9Float64Array(...)18.3.10Function(...)18.3.11Int8Array(...)18.3.12Int16Array(...)18.3.13Int32Array(...)18.3.14Map(...)18.3.15Number(...)

  • 18.3.16Object(...)18.3.17Proxy(...)18.3.18Promise(...)18.3.19RangeError(...)18.3.20ReferenceError(...)18.3.21RegExp(...)18.3.22Set(...)18.3.23SharedArrayBuffer(...)18.3.24String(...)18.3.25Symbol(...)18.3.26SyntaxError(...)18.3.27TypeError(...)18.3.28Uint8Array(...)18.3.29Uint8ClampedArray(...)18.3.30Uint16Array(...)18.3.31Uint32Array(...)18.3.32URIError(...)18.3.33WeakMap(...)18.3.34WeakSet(...)

    18.4OtherPropertiesoftheGlobalObject18.4.1Atomics18.4.2JSON18.4.3Math18.4.4Relect

    19FundamentalObjects19.1ObjectObjects19.1.1TheObjectConstructor19.1.1.1Object([value])

    19.1.2PropertiesoftheObjectConstructor19.1.2.1Object.assign(target,...sources)19.1.2.2Object.create(O,Properties)19.1.2.3Object.deineProperties(O,Properties)19.1.2.3.1RS:ObjectDeineProperties(O,Properties)

    19.1.2.4Object.deineProperty(O,P,Attributes)19.1.2.5Object.entries(O)19.1.2.6Object.freeze(O)19.1.2.7Object.getOwnPropertyDescriptor(O,P)19.1.2.8Object.getOwnPropertyDescriptors(O)19.1.2.9Object.getOwnPropertyNames(O)19.1.2.10Object.getOwnPropertySymbols(O)

  • 19.1.2.10.1RS:GetOwnPropertyKeys(O,Type)19.1.2.11Object.getPrototypeOf(O)19.1.2.12Object.is(value1,value2)19.1.2.13Object.isExtensible(O)19.1.2.14Object.isFrozen(O)19.1.2.15Object.isSealed(O)19.1.2.16Object.keys(O)19.1.2.17Object.preventExtensions(O)19.1.2.18Object.prototype19.1.2.19Object.seal(O)19.1.2.20Object.setPrototypeOf(O,proto)19.1.2.21Object.values(O)

    19.1.3PropertiesoftheObjectPrototypeObject19.1.3.1Object.prototype.constructor19.1.3.2Object.prototype.hasOwnProperty(V)19.1.3.3Object.prototype.isPrototypeOf(V)19.1.3.4Object.prototype.propertyIsEnumerable(V)19.1.3.5Object.prototype.toLocaleString([reserved1[,reserved2]])19.1.3.6Object.prototype.toString()19.1.3.7Object.prototype.valueOf()

    19.1.4PropertiesofObjectInstances19.2FunctionObjects19.2.1TheFunctionConstructor19.2.1.1Function(p1,p2,,pn,body)19.2.1.1.1RS:CreateDynamicFunction(constructor,newTarget,kind,args)

    19.2.2PropertiesoftheFunctionConstructor19.2.2.1Function.length19.2.2.2Function.prototype

    19.2.3PropertiesoftheFunctionPrototypeObject19.2.3.1Function.prototype.apply(thisArg,argArray)19.2.3.2Function.prototype.bind(thisArg,...args)19.2.3.3Function.prototype.call(thisArg,...args)19.2.3.4Function.prototype.constructor19.2.3.5Function.prototype.toString()19.2.3.6Function.prototype[@@hasInstance](V)

    19.2.4FunctionInstances19.2.4.1length19.2.4.2name19.2.4.3prototype

    19.3BooleanObjects

  • 19.3.1TheBooleanConstructor19.3.1.1Boolean(value)

    19.3.2PropertiesoftheBooleanConstructor19.3.2.1Boolean.prototype

    19.3.3PropertiesoftheBooleanPrototypeObject19.3.3.1Boolean.prototype.constructor19.3.3.2Boolean.prototype.toString()19.3.3.3Boolean.prototype.valueOf()

    19.3.4PropertiesofBooleanInstances19.4SymbolObjects19.4.1TheSymbolConstructor19.4.1.1Symbol([description])

    19.4.2PropertiesoftheSymbolConstructor19.4.2.1Symbol.for(key)19.4.2.2Symbol.hasInstance19.4.2.3Symbol.isConcatSpreadable19.4.2.4Symbol.iterator19.4.2.5Symbol.keyFor(sym)19.4.2.6Symbol.match19.4.2.7Symbol.prototype19.4.2.8Symbol.replace19.4.2.9Symbol.search19.4.2.10Symbol.species19.4.2.11Symbol.split19.4.2.12Symbol.toPrimitive19.4.2.13Symbol.toStringTag19.4.2.14Symbol.unscopables

    19.4.3PropertiesoftheSymbolPrototypeObject19.4.3.1Symbol.prototype.constructor19.4.3.2Symbol.prototype.toString()19.4.3.2.1RS:SymbolDescriptiveString(sym)

    19.4.3.3Symbol.prototype.valueOf()19.4.3.4Symbol.prototype[@@toPrimitive](hint)19.4.3.5Symbol.prototype[@@toStringTag]

    19.4.4PropertiesofSymbolInstances19.5ErrorObjects19.5.1TheErrorConstructor19.5.1.1Error(message)

    19.5.2PropertiesoftheErrorConstructor19.5.2.1Error.prototype

  • 19.5.3PropertiesoftheErrorPrototypeObject19.5.3.1Error.prototype.constructor19.5.3.2Error.prototype.message19.5.3.3Error.prototype.name19.5.3.4Error.prototype.toString()

    19.5.4PropertiesofErrorInstances19.5.5NativeErrorTypesUsedinThisStandard19.5.5.1EvalError19.5.5.2RangeError19.5.5.3ReferenceError19.5.5.4SyntaxError19.5.5.5TypeError19.5.5.6URIError

    19.5.6NativeErrorObjectStructure19.5.6.1NativeErrorConstructors19.5.6.1.1NativeError(message)

    19.5.6.2PropertiesoftheNativeErrorConstructors19.5.6.2.1NativeError.prototype

    19.5.6.3PropertiesoftheNativeErrorPrototypeObjects19.5.6.3.1NativeError.prototype.constructor19.5.6.3.2NativeError.prototype.message19.5.6.3.3NativeError.prototype.name

    19.5.6.4PropertiesofNativeErrorInstances20NumbersandDates20.1NumberObjects20.1.1TheNumberConstructor20.1.1.1Number(value)

    20.1.2PropertiesoftheNumberConstructor20.1.2.1Number.EPSILON20.1.2.2Number.isFinite(number)20.1.2.3Number.isInteger(number)20.1.2.4Number.isNaN(number)20.1.2.5Number.isSafeInteger(number)20.1.2.6Number.MAX_SAFE_INTEGER20.1.2.7Number.MAX_VALUE20.1.2.8Number.MIN_SAFE_INTEGER20.1.2.9Number.MIN_VALUE20.1.2.10Number.NaN20.1.2.11Number.NEGATIVE_INFINITY20.1.2.12Number.parseFloat(string)

  • 20.1.2.13Number.parseInt(string,radix)20.1.2.14Number.POSITIVE_INFINITY20.1.2.15Number.prototype

    20.1.3PropertiesoftheNumberPrototypeObject20.1.3.1Number.prototype.constructor20.1.3.2Number.prototype.toExponential(fractionDigits)20.1.3.3Number.prototype.toFixed(fractionDigits)20.1.3.4Number.prototype.toLocaleString([reserved1[,reserved2]])20.1.3.5Number.prototype.toPrecision(precision)20.1.3.6Number.prototype.toString([radix])20.1.3.7Number.prototype.valueOf()

    20.1.4PropertiesofNumberInstances20.2TheMathObject20.2.1ValuePropertiesoftheMathObject20.2.1.1Math.E20.2.1.2Math.LN1020.2.1.3Math.LN220.2.1.4Math.LOG10E20.2.1.5Math.LOG2E20.2.1.6Math.PI20.2.1.7Math.SQRT1_220.2.1.8Math.SQRT220.2.1.9Math[@@toStringTag]

    20.2.2FunctionPropertiesoftheMathObject20.2.2.1Math.abs(x)20.2.2.2Math.acos(x)20.2.2.3Math.acosh(x)20.2.2.4Math.asin(x)20.2.2.5Math.asinh(x)20.2.2.6Math.atan(x)20.2.2.7Math.atanh(x)20.2.2.8Math.atan2(y,x)20.2.2.9Math.cbrt(x)20.2.2.10Math.ceil(x)20.2.2.11Math.clz32(x)20.2.2.12Math.cos(x)20.2.2.13Math.cosh(x)20.2.2.14Math.exp(x)20.2.2.15Math.expm1(x)20.2.2.16Math.loor(x)

  • 20.2.2.17Math.fround(x)20.2.2.18Math.hypot(value1,value2,...values)20.2.2.19Math.imul(x,y)20.2.2.20Math.log(x)20.2.2.21Math.log1p(x)20.2.2.22Math.log10(x)20.2.2.23Math.log2(x)20.2.2.24Math.max(value1,value2,...values)20.2.2.25Math.min(value1,value2,...values)20.2.2.26Math.pow(base,exponent)20.2.2.27Math.random()20.2.2.28Math.round(x)20.2.2.29Math.sign(x)20.2.2.30Math.sin(x)20.2.2.31Math.sinh(x)20.2.2.32Math.sqrt(x)20.2.2.33Math.tan(x)20.2.2.34Math.tanh(x)20.2.2.35Math.trunc(x)

    20.3DateObjects20.3.1OverviewofDateObjectsandDeinitionsofAbstractOperations20.3.1.1TimeValuesandTimeRange20.3.1.2DayNumberandTimewithinDay20.3.1.3YearNumber20.3.1.4MonthNumber20.3.1.5DateNumber20.3.1.6WeekDay20.3.1.7LocalTimeZoneAdjustment20.3.1.8DaylightSavingTimeAdjustment20.3.1.9LocalTime(t)20.3.1.10UTC(t)20.3.1.11Hours,Minutes,Second,andMilliseconds20.3.1.12MakeTime(hour,min,sec,ms)20.3.1.13MakeDay(year,month,date)20.3.1.14MakeDate(day,time)20.3.1.15TimeClip(time)20.3.1.16DateTimeStringFormat20.3.1.16.1ExtendedYears

    20.3.2TheDateConstructor20.3.2.1Date(year,month[,date[,hours[,minutes[,seconds[,ms]]]]])

  • 20.3.2.2Date(value)20.3.2.3Date()

    20.3.3PropertiesoftheDateConstructor20.3.3.1Date.now()20.3.3.2Date.parse(string)20.3.3.3Date.prototype20.3.3.4Date.UTC(year[,month[,date[,hours[,minutes[,seconds[,ms]]]]]])

    20.3.4PropertiesoftheDatePrototypeObject20.3.4.1Date.prototype.constructor20.3.4.2Date.prototype.getDate()20.3.4.3Date.prototype.getDay()20.3.4.4Date.prototype.getFullYear()20.3.4.5Date.prototype.getHours()20.3.4.6Date.prototype.getMilliseconds()20.3.4.7Date.prototype.getMinutes()20.3.4.8Date.prototype.getMonth()20.3.4.9Date.prototype.getSeconds()20.3.4.10Date.prototype.getTime()20.3.4.11Date.prototype.getTimezoneOffset()20.3.4.12Date.prototype.getUTCDate()20.3.4.13Date.prototype.getUTCDay()20.3.4.14Date.prototype.getUTCFullYear()20.3.4.15Date.prototype.getUTCHours()20.3.4.16Date.prototype.getUTCMilliseconds()20.3.4.17Date.prototype.getUTCMinutes()20.3.4.18Date.prototype.getUTCMonth()20.3.4.19Date.prototype.getUTCSeconds()20.3.4.20Date.prototype.setDate(date)20.3.4.21Date.prototype.setFullYear(year[,month[,date]])20.3.4.22Date.prototype.setHours(hour[,min[,sec[,ms]]])20.3.4.23Date.prototype.setMilliseconds(ms)20.3.4.24Date.prototype.setMinutes(min[,sec[,ms]])20.3.4.25Date.prototype.setMonth(month[,date])20.3.4.26Date.prototype.setSeconds(sec[,ms])20.3.4.27Date.prototype.setTime(time)20.3.4.28Date.prototype.setUTCDate(date)20.3.4.29Date.prototype.setUTCFullYear(year[,month[,date]])20.3.4.30Date.prototype.setUTCHours(hour[,min[,sec[,ms]]])20.3.4.31Date.prototype.setUTCMilliseconds(ms)20.3.4.32Date.prototype.setUTCMinutes(min[,sec[,ms]])

  • 20.3.4.33Date.prototype.setUTCMonth(month[,date])20.3.4.34Date.prototype.setUTCSeconds(sec[,ms])20.3.4.35Date.prototype.toDateString()20.3.4.36Date.prototype.toISOString()20.3.4.37Date.prototype.toJSON(key)20.3.4.38Date.prototype.toLocaleDateString([reserved1[,reserved2]])20.3.4.39Date.prototype.toLocaleString([reserved1[,reserved2]])20.3.4.40Date.prototype.toLocaleTimeString([reserved1[,reserved2]])20.3.4.41Date.prototype.toString()20.3.4.41.1RS:ToDateString(tv)

    20.3.4.42Date.prototype.toTimeString()20.3.4.43Date.prototype.toUTCString()20.3.4.44Date.prototype.valueOf()20.3.4.45Date.prototype[@@toPrimitive](hint)

    20.3.5PropertiesofDateInstances21TextProcessing21.1StringObjects21.1.1TheStringConstructor21.1.1.1String(value)

    21.1.2PropertiesoftheStringConstructor21.1.2.1String.fromCharCode(...codeUnits)21.1.2.2String.fromCodePoint(...codePoints)21.1.2.3String.prototype21.1.2.4String.raw(template,...substitutions)

    21.1.3PropertiesoftheStringPrototypeObject21.1.3.1String.prototype.charAt(pos)21.1.3.2String.prototype.charCodeAt(pos)21.1.3.3String.prototype.codePointAt(pos)21.1.3.4String.prototype.concat(...args)21.1.3.5String.prototype.constructor21.1.3.6String.prototype.endsWith(searchString[,endPosition])21.1.3.7String.prototype.includes(searchString[,position])21.1.3.8String.prototype.indexOf(searchString[,position])21.1.3.9String.prototype.lastIndexOf(searchString[,position])21.1.3.10String.prototype.localeCompare(that[,reserved1[,reserved2]])21.1.3.11String.prototype.match(regexp)21.1.3.12String.prototype.normalize([form])21.1.3.13String.prototype.padEnd(maxLength[,illString])21.1.3.14String.prototype.padStart(maxLength[,illString])21.1.3.15String.prototype.repeat(count)

  • 21.1.3.16String.prototype.replace(searchValue,replaceValue)21.1.3.16.1RS:GetSubstitution(matched,str,position,captures,replacement)

    21.1.3.17String.prototype.search(regexp)21.1.3.18String.prototype.slice(start,end)21.1.3.19String.prototype.split(separator,limit)21.1.3.19.1RS:SplitMatch(S,q,R)

    21.1.3.20String.prototype.startsWith(searchString[,position])21.1.3.21String.prototype.substring(start,end)21.1.3.22String.prototype.toLocaleLowerCase([reserved1[,reserved2]])21.1.3.23String.prototype.toLocaleUpperCase([reserved1[,reserved2]])21.1.3.24String.prototype.toLowerCase()21.1.3.25String.prototype.toString()21.1.3.26String.prototype.toUpperCase()21.1.3.27String.prototype.trim()21.1.3.28String.prototype.valueOf()21.1.3.29String.prototype[@@iterator]()

    21.1.4PropertiesofStringInstances21.1.4.1length

    21.1.5StringIteratorObjects21.1.5.1CreateStringIterator(string)21.1.5.2The%StringIteratorPrototype%Object21.1.5.2.1%StringIteratorPrototype%.next()21.1.5.2.2%StringIteratorPrototype%[@@toStringTag]

    21.1.5.3PropertiesofStringIteratorInstances21.2RegExp(RegularExpression)Objects21.2.1Patterns21.2.1.1SS:EarlyErrors

    21.2.2PatternSemantics21.2.2.1Notation21.2.2.2Pattern21.2.2.3Disjunction21.2.2.4Alternative21.2.2.5Term21.2.2.5.1RS:RepeatMatcher(m,min,max,greedy,x,c,parenIndex,parenCount)

    21.2.2.6Assertion21.2.2.6.1RS:WordCharacters()21.2.2.6.2RS:IsWordChar(e)

    21.2.2.7Quantiier21.2.2.8Atom21.2.2.8.1RS:CharacterSetMatcher(A,invert)

  • 21.2.2.8.2RS:Canonicalize(ch)21.2.2.9AtomEscape21.2.2.10CharacterEscape21.2.2.11DecimalEscape21.2.2.12CharacterClassEscape21.2.2.13CharacterClass21.2.2.14ClassRanges21.2.2.15NonemptyClassRanges21.2.2.15.1RS:CharacterRange(A,B)

    21.2.2.16NonemptyClassRangesNoDash21.2.2.17ClassAtom21.2.2.18ClassAtomNoDash21.2.2.19ClassEscape

    21.2.3TheRegExpConstructor21.2.3.1RegExp(pattern,lags)21.2.3.2AbstractOperationsfortheRegExpConstructor21.2.3.2.1RS:RegExpAlloc(newTarget)21.2.3.2.2RS:RegExpInitialize(obj,pattern,lags)21.2.3.2.3RS:RegExpCreate(P,F)21.2.3.2.4RS:EscapeRegExpPattern(P,F)

    21.2.4PropertiesoftheRegExpConstructor21.2.4.1RegExp.prototype21.2.4.2getRegExp[@@species]

    21.2.5PropertiesoftheRegExpPrototypeObject21.2.5.1RegExp.prototype.constructor21.2.5.2RegExp.prototype.exec(string)21.2.5.2.1RS:RegExpExec(R,S)21.2.5.2.2RS:RegExpBuiltinExec(R,S)21.2.5.2.3AdvanceStringIndex(S,index,unicode)

    21.2.5.3getRegExp.prototype.lags21.2.5.4getRegExp.prototype.global21.2.5.5getRegExp.prototype.ignoreCase21.2.5.6RegExp.prototype[@@match](string)21.2.5.7getRegExp.prototype.multiline21.2.5.8RegExp.prototype[@@replace](string,replaceValue)21.2.5.9RegExp.prototype[@@search](string)21.2.5.10getRegExp.prototype.source21.2.5.11RegExp.prototype[@@split](string,limit)21.2.5.12getRegExp.prototype.sticky21.2.5.13RegExp.prototype.test(S)

  • 21.2.5.14RegExp.prototype.toString()21.2.5.15getRegExp.prototype.unicode

    21.2.6PropertiesofRegExpInstances21.2.6.1lastIndex

    22IndexedCollections22.1ArrayObjects22.1.1TheArrayConstructor22.1.1.1Array()22.1.1.2Array(len)22.1.1.3Array(...items)

    22.1.2PropertiesoftheArrayConstructor22.1.2.1Array.from(items[,mapfn[,thisArg]])22.1.2.2Array.isArray(arg)22.1.2.3Array.of(...items)22.1.2.4Array.prototype22.1.2.5getArray[@@species]

    22.1.3PropertiesoftheArrayPrototypeObject22.1.3.1Array.prototype.concat(...arguments)22.1.3.1.1RS:IsConcatSpreadable(O)

    22.1.3.2Array.prototype.constructor22.1.3.3Array.prototype.copyWithin(target,start[,end])22.1.3.4Array.prototype.entries()22.1.3.5Array.prototype.every(callbackfn[,thisArg])22.1.3.6Array.prototype.ill(value[,start[,end]])22.1.3.7Array.prototype.ilter(callbackfn[,thisArg])22.1.3.8Array.prototype.ind(predicate[,thisArg])22.1.3.9Array.prototype.indIndex(predicate[,thisArg])22.1.3.10Array.prototype.forEach(callbackfn[,thisArg])22.1.3.11Array.prototype.includes(searchElement[,fromIndex])22.1.3.12Array.prototype.indexOf(searchElement[,fromIndex])22.1.3.13Array.prototype.join(separator)22.1.3.14Array.prototype.keys()22.1.3.15Array.prototype.lastIndexOf(searchElement[,fromIndex])22.1.3.16Array.prototype.map(callbackfn[,thisArg])22.1.3.17Array.prototype.pop()22.1.3.18Array.prototype.push(...items)22.1.3.19Array.prototype.reduce(callbackfn[,initialValue])22.1.3.20Array.prototype.reduceRight(callbackfn[,initialValue])22.1.3.21Array.prototype.reverse()22.1.3.22Array.prototype.shift()

  • 22.1.3.23Array.prototype.slice(start,end)22.1.3.24Array.prototype.some(callbackfn[,thisArg])22.1.3.25Array.prototype.sort(comparefn)22.1.3.25.1RS:SortCompare(x,y)

    22.1.3.26Array.prototype.splice(start,deleteCount,...items)22.1.3.27Array.prototype.toLocaleString([reserved1[,reserved2]])22.1.3.28Array.prototype.toString()22.1.3.29Array.prototype.unshift(...items)22.1.3.30Array.prototype.values()22.1.3.31Array.prototype[@@iterator]()22.1.3.32Array.prototype[@@unscopables]

    22.1.4PropertiesofArrayInstances22.1.4.1length

    22.1.5ArrayIteratorObjects22.1.5.1CreateArrayIterator(array,kind)22.1.5.2The%ArrayIteratorPrototype%Object22.1.5.2.1%ArrayIteratorPrototype%.next()22.1.5.2.2%ArrayIteratorPrototype%[@@toStringTag]

    22.1.5.3PropertiesofArrayIteratorInstances22.2TypedArrayObjects22.2.1The%TypedArray%IntrinsicObject22.2.1.1%TypedArray%()

    22.2.2Propertiesofthe%TypedArray%IntrinsicObject22.2.2.1%TypedArray%.from(source[,mapfn[,thisArg]])22.2.2.1.1RS:IterableToList(items,method)

    22.2.2.2%TypedArray%.of(...items)22.2.2.3%TypedArray%.prototype22.2.2.4get%TypedArray%[@@species]

    22.2.3Propertiesofthe%TypedArrayPrototype%Object22.2.3.1get%TypedArray%.prototype.buffer22.2.3.2get%TypedArray%.prototype.byteLength22.2.3.3get%TypedArray%.prototype.byteOffset22.2.3.4%TypedArray%.prototype.constructor22.2.3.5%TypedArray%.prototype.copyWithin(target,start[,end])22.2.3.5.1RS:ValidateTypedArray(O)

    22.2.3.6%TypedArray%.prototype.entries()22.2.3.7%TypedArray%.prototype.every(callbackfn[,thisArg])22.2.3.8%TypedArray%.prototype.ill(value[,start[,end]])22.2.3.9%TypedArray%.prototype.ilter(callbackfn[,thisArg])22.2.3.10%TypedArray%.prototype.ind(predicate[,thisArg])

  • 22.2.3.11%TypedArray%.prototype.indIndex(predicate[,thisArg])22.2.3.12%TypedArray%.prototype.forEach(callbackfn[,thisArg])22.2.3.13%TypedArray%.prototype.includes(searchElement[,fromIndex])22.2.3.14%TypedArray%.prototype.indexOf(searchElement[,fromIndex])22.2.3.15%TypedArray%.prototype.join(separator)22.2.3.16%TypedArray%.prototype.keys()22.2.3.17%TypedArray%.prototype.lastIndexOf(searchElement[,fromIndex])22.2.3.18get%TypedArray%.prototype.length22.2.3.19%TypedArray%.prototype.map(callbackfn[,thisArg])22.2.3.20%TypedArray%.prototype.reduce(callbackfn[,initialValue])22.2.3.21%TypedArray%.prototype.reduceRight(callbackfn[,initialValue])22.2.3.22%TypedArray%.prototype.reverse()22.2.3.23%TypedArray%.prototype.set(overloaded[,offset])22.2.3.23.1%TypedArray%.prototype.set(array[,offset])22.2.3.23.2%TypedArray%.prototype.set(typedArray[,offset])

    22.2.3.24%TypedArray%.prototype.slice(start,end)22.2.3.25%TypedArray%.prototype.some(callbackfn[,thisArg])22.2.3.26%TypedArray%.prototype.sort(comparefn)22.2.3.27%TypedArray%.prototype.subarray(begin,end)22.2.3.28%TypedArray%.prototype.toLocaleString([reserved1[,reserved2]])22.2.3.29%TypedArray%.prototype.toString()22.2.3.30%TypedArray%.prototype.values()22.2.3.31%TypedArray%.prototype[@@iterator]()22.2.3.32get%TypedArray%.prototype[@@toStringTag]

    22.2.4TheTypedArrayConstructors22.2.4.1TypedArray()22.2.4.2TypedArray(length)22.2.4.2.1RS:AllocateTypedArray(constructorName,newTarget,defaultProto[,length])22.2.4.2.2RS:AllocateTypedArrayBuffer(O,length)

    22.2.4.3TypedArray(typedArray)22.2.4.4TypedArray(object)22.2.4.5TypedArray(buffer[,byteOffset[,length]])22.2.4.6TypedArrayCreate(constructor,argumentList)22.2.4.7TypedArraySpeciesCreate(exemplar,argumentList)

    22.2.5PropertiesoftheTypedArrayConstructors22.2.5.1TypedArray.BYTES_PER_ELEMENT22.2.5.2TypedArray.prototype

    22.2.6PropertiesofTypedArrayPrototypeObjects22.2.6.1TypedArray.prototype.BYTES_PER_ELEMENT22.2.6.2TypedArray.prototype.constructor

  • 22.2.7PropertiesofTypedArrayInstances23KeyedCollection23.1MapObjects23.1.1TheMapConstructor23.1.1.1Map([iterable])

    23.1.2PropertiesoftheMapConstructor23.1.2.1Map.prototype23.1.2.2getMap[@@species]

    23.1.3PropertiesoftheMapPrototypeObject23.1.3.1Map.prototype.clear()23.1.3.2Map.prototype.constructor23.1.3.3Map.prototype.delete(key)23.1.3.4Map.prototype.entries()23.1.3.5Map.prototype.forEach(callbackfn[,thisArg])23.1.3.6Map.prototype.get(key)23.1.3.7Map.prototype.has(key)23.1.3.8Map.prototype.keys()23.1.3.9Map.prototype.set(key,value)23.1.3.10getMap.prototype.size23.1.3.11Map.prototype.values()23.1.3.12Map.prototype[@@iterator]()23.1.3.13Map.prototype[@@toStringTag]

    23.1.4PropertiesofMapInstances23.1.5MapIteratorObjects23.1.5.1CreateMapIterator(map,kind)23.1.5.2The%MapIteratorPrototype%Object23.1.5.2.1%MapIteratorPrototype%.next()23.1.5.2.2%MapIteratorPrototype%[@@toStringTag]

    23.1.5.3PropertiesofMapIteratorInstances23.2SetObjects23.2.1TheSetConstructor23.2.1.1Set([iterable])

    23.2.2PropertiesoftheSetConstructor23.2.2.1Set.prototype23.2.2.2getSet[@@species]

    23.2.3PropertiesoftheSetPrototypeObject23.2.3.1Set.prototype.add(value)23.2.3.2Set.prototype.clear()23.2.3.3Set.prototype.constructor23.2.3.4Set.prototype.delete(value)

  • 23.2.3.5Set.prototype.entries()23.2.3.6Set.prototype.forEach(callbackfn[,thisArg])23.2.3.7Set.prototype.has(value)23.2.3.8Set.prototype.keys()23.2.3.9getSet.prototype.size23.2.3.10Set.prototype.values()23.2.3.11Set.prototype[@@iterator]()23.2.3.12Set.prototype[@@toStringTag]

    23.2.4PropertiesofSetInstances23.2.5SetIteratorObjects23.2.5.1CreateSetIterator(set,kind)23.2.5.2The%SetIteratorPrototype%Object23.2.5.2.1%SetIteratorPrototype%.next()23.2.5.2.2%SetIteratorPrototype%[@@toStringTag]

    23.2.5.3PropertiesofSetIteratorInstances23.3WeakMapObjects23.3.1TheWeakMapConstructor23.3.1.1WeakMap([iterable])

    23.3.2PropertiesoftheWeakMapConstructor23.3.2.1WeakMap.prototype

    23.3.3PropertiesoftheWeakMapPrototypeObject23.3.3.1WeakMap.prototype.constructor23.3.3.2WeakMap.prototype.delete(key)23.3.3.3WeakMap.prototype.get(key)23.3.3.4WeakMap.prototype.has(key)23.3.3.5WeakMap.prototype.set(key,value)23.3.3.6WeakMap.prototype[@@toStringTag]

    23.3.4PropertiesofWeakMapInstances23.4WeakSetObjects23.4.1TheWeakSetConstructor23.4.1.1WeakSet([iterable])

    23.4.2PropertiesoftheWeakSetConstructor23.4.2.1WeakSet.prototype

    23.4.3PropertiesoftheWeakSetPrototypeObject23.4.3.1WeakSet.prototype.add(value)23.4.3.2WeakSet.prototype.constructor23.4.3.3WeakSet.prototype.delete(value)23.4.3.4WeakSet.prototype.has(value)23.4.3.5WeakSet.prototype[@@toStringTag]

    23.4.4PropertiesofWeakSetInstances

  • 24StructuredData24.1ArrayBufferObjects24.1.1AbstractOperationsForArrayBufferObjects24.1.1.1AllocateArrayBuffer(constructor,byteLength)24.1.1.2IsDetachedBuffer(arrayBuffer)24.1.1.3DetachArrayBuffer(arrayBuffer)24.1.1.4CloneArrayBuffer(srcBuffer,srcByteOffset,srcLength[,cloneConstructor])24.1.1.5RawBytesToNumber(type,rawBytes,isLittleEndian)24.1.1.6GetValueFromBuffer(arrayBuffer,byteIndex,type,isTypedArray,order[,isLittleEndian])24.1.1.7NumberToRawBytes(type,value,isLittleEndian)24.1.1.8SetValueInBuffer(arrayBuffer,byteIndex,type,value,isTypedArray,order[,isLittleEndian])24.1.1.9GetModifySetValueInBuffer(arrayBuffer,byteIndex,type,value,op[,isLittleEndian])

    24.1.2TheArrayBufferConstructor24.1.2.1ArrayBuffer(length)

    24.1.3PropertiesoftheArrayBufferConstructor24.1.3.1ArrayBuffer.isView(arg)24.1.3.2ArrayBuffer.prototype24.1.3.3getArrayBuffer[@@species]

    24.1.4PropertiesoftheArrayBufferPrototypeObject24.1.4.1getArrayBuffer.prototype.byteLength24.1.4.2ArrayBuffer.prototype.constructor24.1.4.3ArrayBuffer.prototype.slice(start,end)24.1.4.4ArrayBuffer.prototype[@@toStringTag]

    24.1.5PropertiesoftheArrayBufferInstances24.2SharedArrayBufferObjects24.2.1AbstractOperationsforSharedArrayBufferObjects24.2.1.1AllocateSharedArrayBuffer(constructor,byteLength)24.2.1.2IsSharedArrayBuffer(obj)

    24.2.2TheSharedArrayBufferConstructor24.2.2.1SharedArrayBuffer(length)

    24.2.3PropertiesoftheSharedArrayBufferConstructor24.2.3.1SharedArrayBuffer.prototype24.2.3.2getSharedArrayBuffer[@@species]

    24.2.4PropertiesoftheSharedArrayBufferPrototypeObject24.2.4.1getSharedArrayBuffer.prototype.byteLength24.2.4.2SharedArrayBuffer.prototype.constructor24.2.4.3SharedArrayBuffer.prototype.slice(start,end)24.2.4.4SharedArrayBuffer.prototype[@@toStringTag]

    24.2.5PropertiesoftheSharedArrayBufferInstances

  • 24.3DataViewObjects24.3.1AbstractOperationsForDataViewObjects24.3.1.1GetViewValue(view,requestIndex,isLittleEndian,type)24.3.1.2SetViewValue(view,requestIndex,isLittleEndian,type,value)

    24.3.2TheDataViewConstructor24.3.2.1DataView(buffer[,byteOffset[,byteLength]])

    24.3.3PropertiesoftheDataViewConstructor24.3.3.1DataView.prototype

    24.3.4PropertiesoftheDataViewPrototypeObject24.3.4.1getDataView.prototype.buffer24.3.4.2getDataView.prototype.byteLength24.3.4.3getDataView.prototype.byteOffset24.3.4.4DataView.prototype.constructor24.3.4.5DataView.prototype.getFloat32(byteOffset[,littleEndian])24.3.4.6DataView.prototype.getFloat64(byteOffset[,littleEndian])24.3.4.7DataView.prototype.getInt8(byteOffset)24.3.4.8DataView.prototype.getInt16(byteOffset[,littleEndian])24.3.4.9DataView.prototype.getInt32(byteOffset[,littleEndian])24.3.4.10DataView.prototype.getUint8(byteOffset)24.3.4.11DataView.prototype.getUint16(byteOffset[,littleEndian])24.3.4.12DataView.prototype.getUint32(byteOffset[,littleEndian])24.3.4.13DataView.prototype.setFloat32(byteOffset,value[,littleEndian])24.3.4.14DataView.prototype.setFloat64(byteOffset,value[,littleEndian])24.3.4.15DataView.prototype.setInt8(byteOffset,value)24.3.4.16DataView.prototype.setInt16(byteOffset,value[,littleEndian])24.3.4.17DataView.prototype.setInt32(byteOffset,value[,littleEndian])24.3.4.18DataView.prototype.setUint8(byteOffset,value)24.3.4.19DataView.prototype.setUint16(byteOffset,value[,littleEndian])24.3.4.20DataView.prototype.setUint32(byteOffset,value[,littleEndian])24.3.4.21DataView.prototype[@@toStringTag]

    24.3.5PropertiesofDataViewInstances24.4TheAtomicsObject24.4.1AbstractOperationsforAtomics24.4.1.1ValidateSharedIntegerTypedArray(typedArray[,onlyInt32])24.4.1.2ValidateAtomicAccess(typedArray,requestIndex)24.4.1.3GetWaiterList(block,i)24.4.1.4EnterCriticalSection(WL)24.4.1.5LeaveCriticalSection(WL)24.4.1.6AddWaiter(WL,W)24.4.1.7RemoveWaiter(WL,W)

  • 24.4.1.8RemoveWaiters(WL,c)24.4.1.9Suspend(WL,W,timeout)24.4.1.10WakeWaiter(WL,W)24.4.1.11AtomicReadModifyWrite(typedArray,index,value,op)24.4.1.12AtomicLoad(typedArray,index)

    24.4.2Atomics.add(typedArray,index,value)24.4.3Atomics.and(typedArray,index,value)24.4.4Atomics.compareExchange(typedArray,index,expectedValue,replacementValue)24.4.5Atomics.exchange(typedArray,index,value)24.4.6Atomics.isLockFree(size)24.4.7Atomics.load(typedArray,index)24.4.8Atomics.or(typedArray,index,value)24.4.9Atomics.store(typedArray,index,value)24.4.10Atomics.sub(typedArray,index,value)24.4.11Atomics.wait(typedArray,index,value,timeout)24.4.12Atomics.wake(typedArray,index,count)24.4.13Atomics.xor(typedArray,index,value)24.4.14Atomics[@@toStringTag]

    24.5TheJSONObject24.5.1JSON.parse(text[,reviver])24.5.1.1RS:InternalizeJSONProperty(holder,name)

    24.5.2JSON.stringify(value[,replacer[,space]])24.5.2.1RS:SerializeJSONProperty(key,holder)24.5.2.2RS:QuoteJSONString(value)24.5.2.3RS:SerializeJSONObject(value)24.5.2.4RS:SerializeJSONArray(value)

    24.5.3JSON[@@toStringTag]25ControlAbstractionObjects25.1Iteration25.1.1CommonIterationInterfaces25.1.1.1TheIterableInterface25.1.1.2TheIteratorInterface25.1.1.3TheIteratorResultInterface

    25.1.2The%IteratorPrototype%Object25.1.2.1%IteratorPrototype%[@@iterator]()

    25.2GeneratorFunctionObjects25.2.1TheGeneratorFunctionConstructor25.2.1.1GeneratorFunction(p1,p2,,pn,body)

    25.2.2PropertiesoftheGeneratorFunctionConstructor25.2.2.1GeneratorFunction.length

  • 25.2.2.2GeneratorFunction.prototype25.2.3PropertiesoftheGeneratorFunctionPrototypeObject25.2.3.1GeneratorFunction.prototype.constructor25.2.3.2GeneratorFunction.prototype.prototype25.2.3.3GeneratorFunction.prototype[@@toStringTag]

    25.2.4GeneratorFunctionInstances25.2.4.1length25.2.4.2name25.2.4.3prototype

    25.3GeneratorObjects25.3.1PropertiesofGeneratorPrototype25.3.1.1Generator.prototype.constructor25.3.1.2Generator.prototype.next(value)25.3.1.3Generator.prototype.return(value)25.3.1.4Generator.prototype.throw(exception)25.3.1.5Generator.prototype[@@toStringTag]

    25.3.2PropertiesofGeneratorInstances25.3.3GeneratorAbstractOperations25.3.3.1GeneratorStart(generator,generatorBody)25.3.3.2GeneratorValidate(generator)25.3.3.3GeneratorResume(generator,value)25.3.3.4GeneratorResumeAbrupt(generator,abruptCompletion)25.3.3.5GeneratorYield(iterNextObj)

    25.4PromiseObjects25.4.1PromiseAbstractOperations25.4.1.1PromiseCapabilityRecords25.4.1.1.1IfAbruptRejectPromise(value,capability)

    25.4.1.2PromiseReactionRecords25.4.1.3CreateResolvingFunctions(promise)25.4.1.3.1PromiseRejectFunctions25.4.1.3.2PromiseResolveFunctions

    25.4.1.4FulillPromise(promise,value)25.4.1.5NewPromiseCapability(C)25.4.1.5.1GetCapabilitiesExecutorFunctions

    25.4.1.6IsPromise(x)25.4.1.7RejectPromise(promise,reason)25.4.1.8TriggerPromiseReactions(reactions,argument)25.4.1.9HostPromiseRejectionTracker(promise,operation)

    25.4.2PromiseJobs25.4.2.1PromiseReactionJob(reaction,argument)

  • 25.4.2.2PromiseResolveThenableJob(promiseToResolve,thenable,then)25.4.3ThePromiseConstructor25.4.3.1Promise(executor)

    25.4.4PropertiesofthePromiseConstructor25.4.4.1Promise.all(iterable)25.4.4.1.1RS:PerformPromiseAll(iteratorRecord,constructor,resultCapability)25.4.4.1.2Promise.allResolveElementFunctions

    25.4.4.2Promise.prototype25.4.4.3Promise.race(iterable)25.4.4.3.1RS:PerformPromiseRace(iteratorRecord,constructor,resultCapability)

    25.4.4.4Promise.reject(r)25.4.4.5Promise.resolve(x)25.4.4.6getPromise[@@species]

    25.4.5PropertiesofthePromisePrototypeObject25.4.5.1Promise.prototype.catch(onRejected)25.4.5.2Promise.prototype.constructor25.4.5.3Promise.prototype.then(onFulilled,onRejected)25.4.5.3.1PerformPromiseThen(promise,onFulilled,onRejected,resultCapability)

    25.4.5.4Promise.prototype[@@toStringTag]25.4.6PropertiesofPromiseInstances

    25.5AsyncFunctionObjects25.5.1TheAsyncFunctionConstructor25.5.1.1AsyncFunction(p1,p2,,pn,body)

    25.5.2PropertiesoftheAsyncFunctionConstructor25.5.2.1AsyncFunction.length25.5.2.2AsyncFunction.prototype

    25.5.3PropertiesoftheAsyncFunctionPrototypeObject25.5.3.1AsyncFunction.prototype.constructor25.5.3.2AsyncFunction.prototype[@@toStringTag]

    25.5.4AsyncFunctionInstances25.5.4.1length25.5.4.2name

    25.5.5AsyncFunctionsAbstractOperations25.5.5.1AsyncFunctionCreate(kind,parameters,body,Scope,Strict)25.5.5.2AsyncFunctionStart(promiseCapability,asyncFunctionBody)25.5.5.3AsyncFunctionAwait(value)25.5.5.4AsyncFunctionAwaitedFulilled25.5.5.5AsyncFunctionAwaitedRejected

    26Relection26.1TheRelectObject

  • 26.1.1Relect.apply(target,thisArgument,argumentsList)26.1.2Relect.construct(target,argumentsList[,newTarget])26.1.3Relect.deineProperty(target,propertyKey,attributes)26.1.4Relect.deleteProperty(target,propertyKey)26.1.5Relect.get(target,propertyKey[,receiver])26.1.6Relect.getOwnPropertyDescriptor(target,propertyKey)26.1.7Relect.getPrototypeOf(target)26.1.8Relect.has(target,propertyKey)26.1.9Relect.isExtensible(target)26.1.10Relect.ownKeys(target)26.1.11Relect.preventExtensions(target)26.1.12Relect.set(target,propertyKey,V[,receiver])26.1.13Relect.setPrototypeOf(target,proto)

    26.2ProxyObjects26.2.1TheProxyConstructor26.2.1.1Proxy(target,handler)

    26.2.2PropertiesoftheProxyConstructor26.2.2.1Proxy.revocable(target,handler)26.2.2.1.1ProxyRevocationFunctions

    26.3ModuleNamespaceObjects26.3.1@@toStringTag

    27MemoryModel27.1MemoryModelFundamentals27.2AgentEventsRecords27.3ChosenValueRecords27.4CandidateExecutions27.5AbstractOperationsfortheMemoryModel27.5.1EventSet(execution)27.5.2SharedDataBlockEventSet(execution)27.5.3HostEventSet(execution)27.5.4ComposeWriteEventBytes(execution,byteIndex,Ws)27.5.5ValueOfReadEvent(execution,R)

    27.6RelationsofCandidateExecutions27.6.1agentorder27.6.2readsbytesfrom27.6.3readsfrom27.6.4hostsynchronizeswith27.6.5synchronizeswith27.6.6happensbefore

    27.7PropertiesofValidExecutions

  • 27.7.1ValidChosenReads27.7.2CoherentReads27.7.3TearFreeReads27.7.4SequentiallyConsistentAtomics27.7.5ValidExecutions

    27.8Races27.9DataRaces27.10DataRaceFreedom27.11SharedMemoryGuidelines

    AGrammarSummaryA.1LexicalGrammarA.2ExpressionsA.3StatementsA.4FunctionsandClassesA.5ScriptsandModulesA.6NumberConversionsA.7UniversalResourceIdentiierCharacterClassesA.8RegularExpressions

    BAdditionalECMAScriptFeaturesforWebBrowsersB.1AdditionalSyntaxB.1.1NumericLiteralsB.1.1.1StaticSemantics

    B.1.2StringLiteralsB.1.2.1StaticSemantics

    B.1.3HTMLlikeCommentsB.1.4RegularExpressionsPatternsB.1.4.1PatternSemanticsB.1.4.1.1RS:CharacterRangeOrUnion(A,B)

    B.2AdditionalBuiltinPropertiesB.2.1AdditionalPropertiesoftheGlobalObjectB.2.1.1escape(string)B.2.1.2unescape(string)

    B.2.2AdditionalPropertiesoftheObject.prototypeObjectB.2.2.1Object.prototype.__proto__B.2.2.1.1getObject.prototype.__proto__B.2.2.1.2setObject.prototype.__proto__

    B.2.2.2Object.prototype.__deineGetter__(P,getter)B.2.2.3Object.prototype.__deineSetter__(P,setter)B.2.2.4Object.prototype.__lookupGetter__(P)B.2.2.5Object.prototype.__lookupSetter__(P)

  • B.2.3AdditionalPropertiesoftheString.prototypeObjectB.2.3.1String.prototype.substr(start,length)B.2.3.2String.prototype.anchor(name)B.2.3.2.1RS:CreateHTML(string,tag,attribute,value)

    B.2.3.3String.prototype.big()B.2.3.4String.prototype.blink()B.2.3.5String.prototype.bold()B.2.3.6String.prototype.ixed()B.2.3.7String.prototype.fontcolor(color)B.2.3.8String.prototype.fontsize(size)B.2.3.9String.prototype.italics()B.2.3.10String.prototype.link(url)B.2.3.11String.prototype.small()B.2.3.12String.prototype.strike()B.2.3.13String.prototype.sub()B.2.3.14String.prototype.sup()

    B.2.4AdditionalPropertiesoftheDate.prototypeObjectB.2.4.1Date.prototype.getYear()B.2.4.2Date.prototype.setYear(year)B.2.4.3Date.prototype.toGMTString()

    B.2.5AdditionalPropertiesoftheRegExp.prototypeObjectB.2.5.1RegExp.prototype.compile(pattern,lags)

    B.3OtherAdditionalFeaturesB.3.1__proto__PropertyNamesinObjectInitializersB.3.2LabelledFunctionDeclarationsB.3.3BlockLevelFunctionDeclarationsWebLegacyCompatibilitySemanticsB.3.3.1ChangestoFunctionDeclarationInstantiationB.3.3.2ChangestoGlobalDeclarationInstantiationB.3.3.3ChangestoEvalDeclarationInstantiationB.3.3.4ChangestoBlockSS:EarlyErrorsB.3.3.5ChangestoswitchStatementSS:EarlyErrorsB.3.3.6ChangestoBlockDeclarationInstantiation

    B.3.4FunctionDeclarationsinIfStatementStatementClausesB.3.5VariableStatementsinCatchBlocksB.3.6InitializersinForInStatementHeads

    CTheStrictModeofECMAScriptDCorrectionsandClariicationsinECMAScript2015withPossibleCompatibilityImpactEAdditionsandChangesThatIntroduceIncompatibilitieswithPriorEditionsFBibliographyGCopyright&SoftwareLicense

    Introduction

  • ThisEcmaStandarddeinestheECMAScript2017Language.ItistheeightheditionoftheECMAScriptLanguageSpeciication.Sincepublicationoftheirsteditionin1997,ECMAScripthasgrowntobeoneoftheworld'smostwidelyusedgeneralpurposeprogramminglanguages.Itisbestknownasthelanguageembeddedinwebbrowsersbuthasalsobeenwidelyadoptedforserverandembeddedapplications.

    ECMAScriptisbasedonseveraloriginatingtechnologies,themostwellknownbeingJavaScript(Netscape)andJScript(Microsoft).ThelanguagewasinventedbyBrendanEichatNetscapeandirstappearedinthatcompany'sNavigator2.0browser.IthasappearedinallsubsequentbrowsersfromNetscapeandinallbrowsersfromMicrosoftstartingwithInternetExplorer3.0.

    ThedevelopmentoftheECMAScriptLanguageSpeciicationstartedinNovember1996.TheirsteditionofthisEcmaStandardwasadoptedbytheEcmaGeneralAssemblyofJune1997.

    ThatEcmaStandardwassubmittedtoISO/IECJTC1foradoptionunderthefasttrackprocedure,andapprovedasinternationalstandardISO/IEC16262,inApril1998.TheEcmaGeneralAssemblyofJune1998approvedthesecondeditionofECMA262tokeepitfullyalignedwithISO/IEC16262.Changesbetweentheirstandthesecondeditionareeditorialinnature.

    ThethirdeditionoftheStandardintroducedpowerfulregularexpressions,betterstringhandling,newcontrolstatements,try/catchexceptionhandling,tighterdeinitionoferrors,formattingfornumericoutputandminorchangesinanticipationoffuturelanguagegrowth.ThethirdeditionoftheECMAScriptstandardwasadoptedbytheEcmaGeneralAssemblyofDecember1999andpublishedasISO/IEC16262:2002inJune2002.

    Afterpublicationofthethirdedition,ECMAScriptachievedmassiveadoptioninconjunctionwiththeWorldWideWebwhereithasbecometheprogramminglanguagethatissupportedbyessentiallyallwebbrowsers.SigniicantworkwasdonetodevelopafourtheditionofECMAScript.However,thatworkwasnotcompletedandnotpublishedasthefourtheditionofECMAScriptbutsomeofitwasincorporatedintothedevelopmentofthesixthedition.

    TheiftheditionofECMAScript(publishedasECMA2625thedition)codiieddefactointerpretationsofthelanguagespeciicationthathavebecomecommonamongbrowserimplementationsandaddedsupportfornewfeaturesthathademergedsincethepublicationofthethirdedition.Suchfeaturesincludeaccessorproperties,relectivecreationandinspectionofobjects,programcontrolofpropertyattributes,additionalarraymanipulationfunctions,supportfortheJSONobjectencodingformat,andastrictmodethatprovidesenhancederrorcheckingandprogramsecurity.TheiftheditionwasadoptedbytheEcmaGeneralAssemblyofDecember2009.

    TheiftheditionwassubmittedtoISO/IECJTC1foradoptionunderthefasttrackprocedure,andapprovedasinternationalstandardISO/IEC16262:2011.Edition5.1oftheECMAScriptStandard

    Introduction

  • incorporatedminorcorrectionsandisthesametextasISO/IEC16262:2011.The5.1EditionwasadoptedbytheEcmaGeneralAssemblyofJune2011.

    Focuseddevelopmentofthesixtheditionstartedin2009,astheiftheditionwasbeingpreparedforpublication.However,thiswasprecededbysigniicantexperimentationandlanguageenhancementdesigneffortsdatingtothepublicationofthethirdeditionin1999.Inaveryrealsense,thecompletionofthesixtheditionistheculminationofaifteenyeareffort.Thegoalsforthisadditionincludedprovidingbettersupportforlargeapplications,librarycreation,andforuseofECMAScriptasacompilationtargetforotherlanguages.Someofitsmajorenhancementsincludedmodules,classdeclarations,lexicalblockscoping,iteratorsandgenerators,promisesforasynchronousprogramming,destructuringpatterns,andpropertailcalls.TheECMAScriptlibraryofbuiltinswasexpandedtosupportadditionaldataabstractionsincludingmaps,sets,andarraysofbinarynumericvaluesaswellasadditionalsupportforUnicodesupplementalcharactersinstringsandregularexpressions.Thebuiltinswerealsomadeextensibleviasubclassing.Thesixtheditionprovidesthefoundationforregular,incrementallanguageandlibraryenhancements.ThesixtheditionwasadoptedbytheGeneralAssemblyofJune2015.

    ECMAScript2016wastheirstECMAScripteditionreleasedunderEcmaTC39'snewyearlyreleasecadenceandopendevelopmentprocess.AplaintextsourcedocumentwasbuiltfromtheECMAScript2015sourcedocumenttoserveasthebaseforfurtherdevelopmententirelyonGitHub.Overtheyearofthisstandard'sdevelopment,hundredsofpullrequestsandissueswereiledrepresentingthousandsofbugixes,editorialixesandotherimprovements.Additionally,numeroussoftwaretoolsweredevelopedtoaidinthiseffortincludingEcmarkup,Ecmarkdown,andGrammarkdown.ES2016alsoincludedsupportforanewexponentiationoperatorandaddsanewmethodtoArray.prototypecalledincludes.

    ThisspeciicationintroducesAsyncFunctions,SharedMemory,andAtomicsalongwithsmallerlanguageandlibraryenhancements,bugixes,andeditorialupdates.Asyncfunctionsimprovetheasynchronousprogrammingexperiencebyprovidingsyntaxforpromisereturningfunctions.SharedMemoryandAtomicsintroduceanewmemorymodelthatallowsmultiagentprogramstocommunicateusingatomicoperationsthatensureawelldeinedexecutionorderevenonparallelCPUs.ThisspeciicationalsoincludesnewstaticmethodsonObject:Object.values,Object.entries,andObject.getOwnPropertyDescriptors.

    DozensofindividualsrepresentingmanyorganizationshavemadeverysigniicantcontributionswithinEcmaTC39tothedevelopmentofthiseditionandtotheprioreditions.Inaddition,avibrantcommunityhasemergedsupportingTC39'sECMAScriptefforts.Thiscommunityhasreviewednumerousdrafts,iledthousandsofbugreports,performedimplementationexperiments,contributedtestsuites,andeducatedtheworldwidedevelopercommunityaboutECMAScript.Unfortunately,itisimpossibletoidentifyandacknowledgeeverypersonandorganizationwhohascontributedtothiseffort.

    AllenWirfsBrock

    ECMA262,6thEditionProjectEditor

  • BrianTerlson

    ECMA262,7thEditionProjectEditor

    ThisStandarddeinestheECMAScript2017generalpurposeprogramminglanguage.

    AconformingimplementationofECMAScriptmustprovideandsupportallthetypes,values,objects,properties,functions,andprogramsyntaxandsemanticsdescribedinthisspeciication.

    AconformingimplementationofECMAScriptmustinterpretsourcetextinputinconformancewiththelatestversionoftheUnicodeStandardandISO/IEC10646.

    AconformingimplementationofECMAScriptthatprovidesanapplicationprogramminginterfacethatsupportsprogramsthatneedtoadapttothelinguisticandculturalconventionsusedbydifferenthumanlanguagesandcountriesmustimplementtheinterfacedeinedbythemostrecenteditionofECMA402thatiscompatiblewiththisspeciication.

    AconformingimplementationofECMAScriptmayprovideadditionaltypes,values,objects,properties,andfunctionsbeyondthosedescribedinthisspeciication.Inparticular,aconformingimplementationofECMAScriptmayprovidepropertiesnotdescribedinthisspeciication,andvaluesforthoseproperties,forobjectsthataredescribedinthisspeciication.

    AconformingimplementationofECMAScriptmaysupportprogramandregularexpressionsyntaxnotdescribedinthisspeciication.Inparticular,aconformingimplementationofECMAScriptmaysupportprogramsyntaxthatmakesuseofthefuturereservedwordslistedinsubclause11.6.2.2ofthisspeciication.

    AconformingimplementationofECMAScriptmustnotimplementanyextensionthatislistedasaForbiddenExtensioninsubclause16.2.

    Thefollowingreferenceddocumentsareindispensablefortheapplicationofthisdocument.Fordatedreferences,onlytheeditioncitedapplies.Forundatedreferences,thelatesteditionofthereferenced

    1 Scope

    2 Conformance

    3 NormativeReferences

  • document(includinganyamendments)applies.

    ISO/IEC10646:2003:InformationTechnologyUniversalMultipleOctetCodedCharacterSet(UCS)plusAmendment1:2005,Amendment2:2006,Amendment3:2008,andAmendment4:2008,plusadditionalamendmentsandcorrigenda,orsuccessor

    ECMA402,ECMAScript2015InternationalizationAPISpeciication.http://www.ecmainternational.org/publications/standards/Ecma402.htm

    ECMA404,TheJSONDataInterchangeFormat.http://www.ecmainternational.org/publications/standards/Ecma404.htm

    ThissectioncontainsanonnormativeoverviewoftheECMAScriptlanguage.

    ECMAScriptisanobjectorientedprogramminglanguageforperformingcomputationsandmanipulatingcomputationalobjectswithinahostenvironment.ECMAScriptasdeinedhereisnotintendedtobecomputationallyselfsuficient;indeed,therearenoprovisionsinthisspeciicationforinputofexternaldataoroutputofcomputedresults.Instead,itisexpectedthatthecomputationalenvironmentofanECMAScriptprogramwillprovidenotonlytheobjectsandotherfacilitiesdescribedinthisspeciicationbutalsocertainenvironmentspeciicobjects,whosedescriptionandbehaviourarebeyondthescopeofthisspeciicationexcepttoindicatethattheymayprovidecertainpropertiesthatcanbeaccessedandcertainfunctionsthatcanbecalledfromanECMAScriptprogram.

    ECMAScriptwasoriginallydesignedtobeusedasascriptinglanguage,buthasbecomewidelyusedasageneralpurposeprogramminglanguage.Ascriptinglanguageisaprogramminglanguagethatisusedtomanipulate,customize,andautomatethefacilitiesofanexistingsystem.Insuchsystems,usefulfunctionalityisalreadyavailablethroughauserinterface,andthescriptinglanguageisamechanismforexposingthatfunctionalitytoprogramcontrol.Inthisway,theexistingsystemissaidtoprovideahostenvironmentofobjectsandfacilities,whichcompletesthecapabilitiesofthescriptinglanguage.Ascriptinglanguageisintendedforusebybothprofessionalandnonprofessionalprogrammers.

    ECMAScriptwasoriginallydesignedtobeaWebscriptinglanguage,providingamechanismtoenlivenWebpagesinbrowsersandtoperformservercomputationaspartofaWebbasedclientserverarchitecture.ECMAScriptisnowusedtoprovidecorescriptingcapabilitiesforavarietyofhostenvironments.Thereforethecorelanguageisspeciiedinthisdocumentapartfromanyparticularhostenvironment.

    ECMAScriptusagehasmovedbeyondsimplescriptinganditisnowusedforthefullspectrumofprogrammingtasksinmanydifferentenvironmentsandscales.AstheusageofECMAScripthasexpanded,

    4 Overview

    http://www.ecma-international.org/publications/standards/Ecma-402.htmhttp://www.ecma-international.org/publications/standards/Ecma-404.htm

  • sohasthefeaturesandfacilitiesitprovides.ECMAScriptisnowafullyfeaturedgeneralpurposeprogramminglanguage.

    SomeofthefacilitiesofECMAScriptaresimilartothoseusedinotherprogramminglanguages;inparticularC,Java,Self,andSchemeasdescribedin:

    ISO/IEC9899:1996,ProgrammingLanguagesC.

    Gosling,James,BillJoyandGuySteele.TheJavaLanguageSpeciication.AddisonWesleyPublishingCo.,1996.

    Ungar,David,andSmith,RandallB.Self:ThePowerofSimplicity.OOPSLA'87ConferenceProceedings,pp.227241,Orlando,FL,October1987.

    IEEEStandardfortheSchemeProgrammingLanguage.IEEEStd11781990.

    AwebbrowserprovidesanECMAScripthostenvironmentforclientsidecomputationincluding,forinstance,objectsthatrepresentwindows,menus,popups,dialogboxes,textareas,anchors,frames,history,cookies,andinput/output.Further,thehostenvironmentprovidesameanstoattachscriptingcodetoeventssuchaschangeoffocus,pageandimageloading,unloading,errorandabort,selection,formsubmission,andmouseactions.ScriptingcodeappearswithintheHTMLandthedisplayedpageisacombinationofuserinterfaceelementsandixedandcomputedtextandimages.Thescriptingcodeisreactivetouserinteraction,andthereisnoneedforamainprogram.

    Awebserverprovidesadifferenthostenvironmentforserversidecomputationincludingobjectsrepresentingrequests,clients,andiles;andmechanismstolockandsharedata.Byusingbrowsersideandserversidescriptingtogether,itispossibletodistributecomputationbetweentheclientandserverwhileprovidingacustomizeduserinterfaceforaWebbasedapplication.

    EachWebbrowserandserverthatsupportsECMAScriptsuppliesitsownhostenvironment,completingtheECMAScriptexecutionenvironment.

    ThefollowingisaninformaloverviewofECMAScriptnotallpartsofthelanguagearedescribed.Thisoverviewisnotpartofthestandardproper.

    ECMAScriptisobjectbased:basiclanguageandhostfacilitiesareprovidedbyobjects,andanECMAScriptprogramisaclusterofcommunicatingobjects.InECMAScript,anobjectisacollectionofzeroormore

    4.1 WebScripting

    4.2 ECMAScriptOverview

  • propertieseachwithattributesthatdeterminehoweachpropertycanbeusedforexample,whentheWritableattributeforapropertyissettofalse,anyattemptbyexecutedECMAScriptcodetoassignadifferentvaluetothepropertyfails.Propertiesarecontainersthatholdotherobjects,primitivevalues,orfunctions.Aprimitivevalueisamemberofoneofthefollowingbuiltintypes:Undeined,Null,Boolean,Number,String,andSymbol;anobjectisamemberofthebuiltintypeObject;andafunctionisacallableobject.Afunctionthatisassociatedwithanobjectviaapropertyiscalledamethod.

    ECMAScriptdeinesacollectionofbuiltinobjectsthatroundoutthedeinitionofECMAScriptentities.Thesebuiltinobjectsincludetheglobalobject;objectsthatarefundamentaltotheruntimesemanticsofthelanguageincludingObject,Function,Boolean,Symbol,andvariousErrorobjects;objectsthatrepresentandmanipulatenumericvaluesincludingMath,Number,andDate;thetextprocessingobjectsStringandRegExp;objectsthatareindexedcollectionsofvaluesincludingArrayandninedifferentkindsofTypedArrayswhoseelementsallhaveaspeciicnumericdatarepresentation;keyedcollectionsincludingMapandSetobjects;objectssupportingstructureddataincludingtheJSONobject,ArrayBuffer,SharedArrayBuffer,andDataView;objectssupportingcontrolabstractionsincludinggeneratorfunctionsandPromiseobjects;andrelectionobjectsincludingProxyandReflect.

    ECMAScriptalsodeinesasetofbuiltinoperators.ECMAScriptoperatorsincludevariousunaryoperations,multiplicativeoperators,additiveoperators,bitwiseshiftoperators,relationaloperators,equalityoperators,binarybitwiseoperators,binarylogicaloperators,assignmentoperators,andthecommaoperator.

    LargeECMAScriptprogramsaresupportedbymoduleswhichallowaprogramtobedividedintomultiplesequencesofstatementsanddeclarations.Eachmoduleexplicitlyidentiiesdeclarationsitusesthatneedtobeprovidedbyothermodulesandwhichofitsdeclarationsareavailableforusebyothermodules.

    ECMAScriptsyntaxintentionallyresemblesJavasyntax.ECMAScriptsyntaxisrelaxedtoenableittoserveasaneasytousescriptinglanguage.Forexample,avariableisnotrequiredtohaveitstypedeclarednoraretypesassociatedwithproperties,anddeinedfunctionsarenotrequiredtohavetheirdeclarationsappeartextuallybeforecallstothem.

    EventhoughECMAScriptincludessyntaxforclassdeinitions,ECMAScriptobjectsarenotfundamentallyclassbasedsuchasthoseinC++,Smalltalk,orJava.Insteadobjectsmaybecreatedinvariouswaysincludingviaaliteralnotationorviaconstructorswhichcreateobjectsandthenexecutecodethatinitializesallorpartofthembyassigninginitialvaluestotheirproperties.Eachconstructorisafunctionthathasapropertynamed"prototype"thatisusedtoimplementprototypebasedinheritanceandsharedproperties.Objectsarecreatedbyusingconstructorsinnewexpressions;forexample,newDate(2009,11)createsanewDateobject.Invokingaconstructorwithoutusingnewhas

    4.2.1 Objects

  • consequencesthatdependontheconstructor.Forexample,Date()producesastringrepresentationofthecurrentdateandtimeratherthananobject.

    Everyobjectcreatedbyaconstructorhasanimplicitreference(calledtheobject'sprototype)tothevalueofitsconstructor's"prototype"property.Furthermore,aprototypemayhaveanonnullimplicitreferencetoitsprototype,andsoon;thisiscalledtheprototypechain.Whenareferenceismadetoapropertyinanobject,thatreferenceistothepropertyofthatnameintheirstobjectintheprototypechainthatcontainsapropertyofthatname.Inotherwords,irsttheobjectmentioneddirectlyisexaminedforsuchaproperty;ifthatobjectcontainsthenamedproperty,thatisthepropertytowhichthereferencerefers;ifthatobjectdoesnotcontainthenamedproperty,theprototypeforthatobjectisexaminednext;andsoon.

    Figure1:Object/PrototypeRelationships

    Inaclassbasedobjectorientedlanguage,ingeneral,stateiscarriedbyinstances,methodsarecarriedbyclasses,andinheritanceisonlyofstructureandbehaviour.InECMAScript,thestateandmethodsarecarriedbyobjects,whilestructure,behaviour,andstateareallinherited.

    Allobjectsthatdonotdirectlycontainaparticularpropertythattheirprototypecontainssharethatpropertyanditsvalue.Figure1illustratesthis:

    CFisaconstructor(andalsoanobject).Fiveobjectshavebeencreatedbyusingnewexpressions:cf1,cf2,cf3,cf4,andcf5.Eachoftheseobjectscontainspropertiesnamedq1andq2.Thedashedlinesrepresenttheimplicitprototyperelationship;so,forexample,cf3'sprototypeisCFp.Theconstructor,CF,hastwopropertiesitself,namedP1andP2,whicharenotvisibletoCFp,cf1,cf2,cf3,cf4,orcf5.Theproperty

    PatrickStamp

  • namedCFP1inCFpissharedbycf1,cf2,cf3,cf4,andcf5(butnotbyCF),asareanypropertiesfoundinCFp'simplicitprototypechainthatarenotnamedq1,q2,orCFP1.NoticethatthereisnoimplicitprototypelinkbetweenCFandCFp.

    Unlikemostclassbasedobjectlanguages,propertiescanbeaddedtoobjectsdynamicallybyassigningvaluestothem.Thatis,constructorsarenotrequiredtonameorassignvaluestoalloranyoftheconstructedobject'sproperties.Intheabovediagram,onecouldaddanewsharedpropertyforcf1,cf2,cf3,cf4,andcf5byassigninganewvaluetothepropertyinCFp.

    AlthoughECMAScriptobjectsarenotinherentlyclassbased,itisoftenconvenienttodeineclasslikeabstractionsbaseduponacommonpatternofconstructorfunctions,prototypeobjects,andmethods.TheECMAScriptbuiltinobjectsthemselvesfollowsuchaclasslikepattern.BeginningwithECMAScript2015,theECMAScriptlanguageincludessyntacticclassdeinitionsthatpermitprogrammerstoconciselydeineobjectsthatconformtothesameclasslikeabstractionpatternusedbythebuiltinobjects.

    TheECMAScriptLanguagerecognizesthepossibilitythatsomeusersofthelanguagemaywishtorestricttheirusageofsomefeaturesavailableinthelanguage.Theymightdosointheinterestsofsecurity,toavoidwhattheyconsidertobeerrorpronefeatures,togetenhancederrorchecking,orforotherreasonsoftheirchoosing.Insupportofthispossibility,ECMAScriptdeinesastrictvariantofthelanguage.ThestrictvariantofthelanguageexcludessomespeciicsyntacticandsemanticfeaturesoftheregularECMAScriptlanguageandmodiiesthedetailedsemanticsofsomefeatures.Thestrictvariantalsospeciiesadditionalerrorconditionsthatmustbereportedbythrowingerrorexceptionsinsituationsthatarenotspeciiedaserrorsbythenonstrictformofthelanguage.

    ThestrictvariantofECMAScriptiscommonlyreferredtoasthestrictmodeofthelanguage.StrictmodeselectionanduseofthestrictmodesyntaxandsemanticsofECMAScriptisexplicitlymadeatthelevelofindividualECMAScriptsourcetextunits.Becausestrictmodeisselectedatthelevelofasyntacticsourcetextunit,strictmodeonlyimposesrestrictionsthathavelocaleffectwithinsuchasourcetextunit.StrictmodedoesnotrestrictormodifyanyaspectoftheECMAScriptsemanticsthatmustoperateconsistentlyacrossmultiplesourcetextunits.AcompleteECMAScriptprogrammaybecomposedofbothstrictmodeandnonstrictmodeECMAScriptsourcetextunits.Inthiscase,strictmodeonlyapplieswhenactuallyexecutingcodethatisdeinedwithinastrictmodesourcetextunit.

    Inordertoconformtothisspeciication,anECMAScriptimplementationmustimplementboththefullunrestrictedECMAScriptlanguageandthestrictvariantoftheECMAScriptlanguageasdeinedbythisspeciication.Inaddition,animplementationmustsupportthecombinationofunrestrictedandstrictmodesourcetextunitsintoasinglecompositeprogram.

    4.2.2 TheStrictVariantofECMAScript

    4.3 TermsandDeinitions

  • Forthepurposesofthisdocument,thefollowingtermsanddeinitionsapply.

    setofdatavaluesasdeinedinclause6ofthisspeciication

    memberofoneofthetypesUndeined,Null,Boolean,Number,Symbol,orStringasdeinedinclause6

    NOTE Aprimitivevalueisadatumthatisrepresenteddirectlyatthelowestlevelofthelanguageimplementation.

    memberofthetypeObject

    NOTE Anobjectisacollectionofpropertiesandhasasingleprototypeobject.Theprototypemaybethenullvalue.

    functionobjectthatcreatesandinitializesobjects

    NOTE Thevalueofaconstructor'sprototypepropertyisaprototypeobjectthatisusedtoimplementinheritanceandsharedproperties.

    objectthatprovidessharedpropertiesforotherobjects

    NOTE Whenaconstructorcreatesanobject,thatobjectimplicitlyreferencestheconstructor'sprototypepropertyforthepurposeofresolvingpropertyreferences.Theconstructor'sprototypepropertycanbereferencedbytheprogramexpressionconstructor.prototype,andpropertiesaddedtoanobject'sprototypeareshared,throughinheritance,byallobjectssharingtheprototype.Alternatively,anewobjectmaybecreatedwithanexplicitlyspeciiedprototypebyusingtheObject.createbuiltinfunction.

    4.3 TermsandDeinitions

    4.3.1 type

    4.3.2 primitivevalue

    4.3.3 object

    4.3.4 constructor

    4.3.5 prototype

    4.3.6 ordinaryobject

  • objectthathasthedefaultbehaviourfortheessentialinternalmethodsthatmustbesupportedbyallobjects

    objectthatdoesnothavethedefaultbehaviourforoneormoreoftheessentialinternalmethods

    NOTE Anyobjectthatisnotanordinaryobjectisanexoticobject.

    objectwhosesemanticsaredeinedbythisspeciication

    objectspeciiedandsuppliedbyanECMAScriptimplementation

    NOTE Standardbuiltinobjectsaredeinedinthisspeciication.AnECMAScriptimplementationmayspecifyandsupplyadditionalkindsofbuiltinobjects.Abuiltinconstructorisabuiltinobjectthatisalsoaconstructor.

    primitivevalueusedwhenavariablehasnotbeenassignedavalue

    typewhosesolevalueistheundeinedvalue

    primitivevaluethatrepresentstheintentionalabsenceofanyobjectvalue

    typewhosesolevalueisthenullvalue

    4.3.6 ordinaryobject

    4.3.7 exoticobject

    4.3.8 standardobject

    4.3.9 builtinobject

    4.3.10 undeinedvalue

    4.3.11 Undeinedtype

    4.3.12 nullvalue

    4.3.13 Nulltype

    4.3.14 Booleanvalue

  • memberoftheBooleantype

    NOTE ThereareonlytwoBooleanvalues,trueandfalse.

    typeconsistingoftheprimitivevaluestrueandfalse

    memberoftheObjecttypethatisaninstanceofthestandardbuiltinBooleanconstructor

    NOTE ABooleanobjectiscreatedbyusingtheBooleanconstructorinanewexpression,supplyingaBooleanvalueasanargument.TheresultingobjecthasaninternalslotwhosevalueistheBooleanvalue.ABooleanobjectcanbecoercedtoaBooleanvalue.

    primitivevaluethatisainiteorderedsequenceofzeroormore16bitunsignedintegervalues

    NOTE AStringvalueisamemberoftheStringtype.Eachintegervalueinthesequenceusuallyrepresentsasingle16bitunitofUTF16text.However,ECMAScriptdoesnotplaceanyrestrictionsorrequirementsonthevaluesexceptthattheymustbe16bitunsignedintegers.

    setofallpossibleStringvalues

    memberoftheObjecttypethatisaninstanceofthestandardbuiltinStringconstructor

    NOTE AStringobjectiscreatedbyusingtheStringconstructorinanewexpression,supplyin