Movatterモバイル変換


[0]ホーム

URL:


Pins
Table of Contents
  1. Introduction
  2. 1 Scope
  3. +2 Conformance
    1. 2.1 Example Normative Optional Clause Heading
    2. 2.2 Example Legacy Clause Heading
    3. 2.3 Example Legacy Normative Optional Clause Heading
  4. 3 Normative References
  5. +4 Overview
    1. 4.1 Web Scripting
    2. 4.2 Hosts and Implementations
    3. +4.3 ECMAScript Overview
      1. 4.3.1 Objects
      2. 4.3.2 The Strict Variant of ECMAScript
    4. +4.4 Terms and Definitions
      1. 4.4.1 implementation-approximated
      2. 4.4.2 implementation-defined
      3. 4.4.3 host-defined
      4. 4.4.4 type
      5. 4.4.5 primitive value
      6. 4.4.6 object
      7. 4.4.7 constructor
      8. 4.4.8 prototype
      9. 4.4.9 ordinary object
      10. 4.4.10 exotic object
      11. 4.4.11 standard object
      12. 4.4.12 built-in object
      13. 4.4.13 undefined value
      14. 4.4.14 Undefined type
      15. 4.4.15 null value
      16. 4.4.16 Null type
      17. 4.4.17 Boolean value
      18. 4.4.18 Boolean type
      19. 4.4.19 Boolean object
      20. 4.4.20 String value
      21. 4.4.21 String type
      22. 4.4.22 String object
      23. 4.4.23 Number value
      24. 4.4.24 Number type
      25. 4.4.25 Number object
      26. 4.4.26 Infinity
      27. 4.4.27 NaN
      28. 4.4.28 BigInt value
      29. 4.4.29 BigInt type
      30. 4.4.30 BigInt object
      31. 4.4.31 Symbol value
      32. 4.4.32 Symbol type
      33. 4.4.33 Symbol object
      34. 4.4.34 function
      35. 4.4.35 built-in function
      36. 4.4.36 built-in constructor
      37. 4.4.37 property
      38. 4.4.38 method
      39. 4.4.39 built-in method
      40. 4.4.40 attribute
      41. 4.4.41 own property
      42. 4.4.42 inherited property
    5. 4.5 Organization of This Specification
  6. +5 Notational Conventions
    1. +5.1 Syntactic and Lexical Grammars
      1. 5.1.1 Context-Free Grammars
      2. 5.1.2 The Lexical and RegExp Grammars
      3. 5.1.3 The Numeric String Grammar
      4. 5.1.4 The Syntactic Grammar
      5. +5.1.5 Grammar Notation
        1. 5.1.5.1 Terminal Symbols
        2. 5.1.5.2 Nonterminal Symbols and Productions
        3. 5.1.5.3 Optional Symbols
        4. 5.1.5.4 Grammatical Parameters
        5. 5.1.5.5 one of
        6. 5.1.5.6 [empty]
        7. 5.1.5.7 Lookahead Restrictions
        8. 5.1.5.8 [noLineTerminator here]
        9. 5.1.5.9 but not
        10. 5.1.5.10 Descriptive Phrases
    2. +5.2 Algorithm Conventions
      1. 5.2.1 Abstract Operations
      2. 5.2.2 Syntax-Directed Operations
      3. +5.2.3 Runtime Semantics
        1. 5.2.3.1 Completion (completionRecord )
        2. 5.2.3.2 Throw an Exception
        3. 5.2.3.3 ReturnIfAbrupt
        4. 5.2.3.4 ReturnIfAbrupt Shorthands
        5. 5.2.3.5 Implicit Normal Completion
      4. 5.2.4 Static Semantics
      5. 5.2.5 Mathematical Operations
      6. 5.2.6 Value Notation
      7. 5.2.7 Identity
  7. +6 ECMAScript Data Types and Values
    1. +6.1 ECMAScript Language Types
      1. 6.1.1 The Undefined Type
      2. 6.1.2 The Null Type
      3. 6.1.3 The Boolean Type
      4. +6.1.4 The String Type
        1. 6.1.4.1 StringIndexOf (string,searchValue,fromIndex )
        2. 6.1.4.2 StringLastIndexOf (string,searchValue,fromIndex )
      5. +6.1.5 The Symbol Type
        1. 6.1.5.1 Well-Known Symbols
      6. +6.1.6 Numeric Types
        1. +6.1.6.1 The Number Type
          1. 6.1.6.1.1 Number::unaryMinus (x )
          2. 6.1.6.1.2 Number::bitwiseNOT (x )
          3. 6.1.6.1.3 Number::exponentiate (base,exponent )
          4. 6.1.6.1.4 Number::multiply (x,y )
          5. 6.1.6.1.5 Number::divide (x,y )
          6. 6.1.6.1.6 Number::remainder (n,d )
          7. 6.1.6.1.7 Number::add (x,y )
          8. 6.1.6.1.8 Number::subtract (x,y )
          9. 6.1.6.1.9 Number::leftShift (x,y )
          10. 6.1.6.1.10 Number::signedRightShift (x,y )
          11. 6.1.6.1.11 Number::unsignedRightShift (x,y )
          12. 6.1.6.1.12 Number::lessThan (x,y )
          13. 6.1.6.1.13 Number::equal (x,y )
          14. 6.1.6.1.14 Number::sameValue (x,y )
          15. 6.1.6.1.15 Number::sameValueZero (x,y )
          16. 6.1.6.1.16 NumberBitwiseOp (op,x,y )
          17. 6.1.6.1.17 Number::bitwiseAND (x,y )
          18. 6.1.6.1.18 Number::bitwiseXOR (x,y )
          19. 6.1.6.1.19 Number::bitwiseOR (x,y )
          20. 6.1.6.1.20 Number::toString (x,radix )
        2. +6.1.6.2 The BigInt Type
          1. 6.1.6.2.1 BigInt::unaryMinus (x )
          2. 6.1.6.2.2 BigInt::bitwiseNOT (x )
          3. 6.1.6.2.3 BigInt::exponentiate (base,exponent )
          4. 6.1.6.2.4 BigInt::multiply (x,y )
          5. 6.1.6.2.5 BigInt::divide (x,y )
          6. 6.1.6.2.6 BigInt::remainder (n,d )
          7. 6.1.6.2.7 BigInt::add (x,y )
          8. 6.1.6.2.8 BigInt::subtract (x,y )
          9. 6.1.6.2.9 BigInt::leftShift (x,y )
          10. 6.1.6.2.10 BigInt::signedRightShift (x,y )
          11. 6.1.6.2.11 BigInt::unsignedRightShift (x,y )
          12. 6.1.6.2.12 BigInt::lessThan (x,y )
          13. 6.1.6.2.13 BigInt::equal (x,y )
          14. 6.1.6.2.14 BinaryAnd (x,y )
          15. 6.1.6.2.15 BinaryOr (x,y )
          16. 6.1.6.2.16 BinaryXor (x,y )
          17. 6.1.6.2.17 BigIntBitwiseOp (op,x,y )
          18. 6.1.6.2.18 BigInt::bitwiseAND (x,y )
          19. 6.1.6.2.19 BigInt::bitwiseXOR (x,y )
          20. 6.1.6.2.20 BigInt::bitwiseOR (x,y )
          21. 6.1.6.2.21 BigInt::toString (x,radix )
      7. +6.1.7 The Object Type
        1. 6.1.7.1 Property Attributes
        2. 6.1.7.2 Object Internal Methods and Internal Slots
        3. 6.1.7.3 Invariants of the Essential Internal Methods
        4. 6.1.7.4 Well-Known Intrinsic Objects
    2. +6.2 ECMAScript Specification Types
      1. 6.2.1 The Enum Specification Type
      2. 6.2.2 The List and Record Specification Types
      3. 6.2.3 The Set and Relation Specification Types
      4. +6.2.4 The Completion Record Specification Type
        1. 6.2.4.1 NormalCompletion (value )
        2. 6.2.4.2 ThrowCompletion (value )
        3. 6.2.4.3 ReturnCompletion (value )
        4. 6.2.4.4 UpdateEmpty (completionRecord,value )
      5. +6.2.5 The Reference Record Specification Type
        1. 6.2.5.1 IsPropertyReference (V )
        2. 6.2.5.2 IsUnresolvableReference (V )
        3. 6.2.5.3 IsSuperReference (V )
        4. 6.2.5.4 IsPrivateReference (V )
        5. 6.2.5.5 GetValue (V )
        6. 6.2.5.6 PutValue (V,W )
        7. 6.2.5.7 GetThisValue (V )
        8. 6.2.5.8 InitializeReferencedBinding (V,W )
        9. 6.2.5.9 MakePrivateReference (baseValue,privateIdentifier )
      6. +6.2.6 The Property Descriptor Specification Type
        1. 6.2.6.1 IsAccessorDescriptor (Desc )
        2. 6.2.6.2 IsDataDescriptor (Desc )
        3. 6.2.6.3 IsGenericDescriptor (Desc )
        4. 6.2.6.4 FromPropertyDescriptor (Desc )
        5. 6.2.6.5 ToPropertyDescriptor (Obj )
        6. 6.2.6.6 CompletePropertyDescriptor (Desc )
      7. 6.2.7 The Environment Record Specification Type
      8. 6.2.8 The Abstract Closure Specification Type
      9. +6.2.9 Data Blocks
        1. 6.2.9.1 CreateByteDataBlock (size )
        2. 6.2.9.2 CreateSharedByteDataBlock (size )
        3. 6.2.9.3 CopyDataBlockBytes (toBlock,toIndex,fromBlock,fromIndex,count )
      10. 6.2.10 The PrivateElement Specification Type
      11. 6.2.11 The ClassFieldDefinition Record Specification Type
      12. 6.2.12 Private Names
      13. 6.2.13 The ClassStaticBlockDefinition Record Specification Type
  8. +7 Abstract Operations
    1. +7.1 Type Conversion
      1. +7.1.1 ToPrimitive (input [ ,preferredType ] )
        1. 7.1.1.1 OrdinaryToPrimitive (O,hint )
      2. 7.1.2 ToBoolean (argument )
      3. 7.1.3 ToNumeric (value )
      4. +7.1.4 ToNumber (argument )
        1. +7.1.4.1 ToNumber Applied to the String Type
          1. 7.1.4.1.1 StringToNumber (str )
          2. 7.1.4.1.2 RS: StringNumericValue
          3. 7.1.4.1.3 RoundMVResult (n )
      5. 7.1.5 ToIntegerOrInfinity (argument )
      6. 7.1.6 ToInt32 (argument )
      7. 7.1.7 ToUint32 (argument )
      8. 7.1.8 ToInt16 (argument )
      9. 7.1.9 ToUint16 (argument )
      10. 7.1.10 ToInt8 (argument )
      11. 7.1.11 ToUint8 (argument )
      12. 7.1.12 ToUint8Clamp (argument )
      13. 7.1.13 ToBigInt (argument )
      14. +7.1.14 StringToBigInt (str )
        1. 7.1.14.1 StringIntegerLiteral Grammar
        2. 7.1.14.2 RS: MV
      15. 7.1.15 ToBigInt64 (argument )
      16. 7.1.16 ToBigUint64 (argument )
      17. 7.1.17 ToString (argument )
      18. 7.1.18 ToObject (argument )
      19. 7.1.19 ToPropertyKey (argument )
      20. 7.1.20 ToLength (argument )
      21. 7.1.21 CanonicalNumericIndexString (argument )
      22. 7.1.22 ToIndex (value )
    2. +7.2 Testing and Comparison Operations
      1. 7.2.1 RequireObjectCoercible (argument )
      2. 7.2.2 IsArray (argument )
      3. 7.2.3 IsCallable (argument )
      4. 7.2.4 IsConstructor (argument )
      5. 7.2.5 IsExtensible (O )
      6. 7.2.6 IsRegExp (argument )
      7. 7.2.7 SS: IsStringWellFormedUnicode (string )
      8. 7.2.8 SameType (x,y )
      9. 7.2.9 SameValue (x,y )
      10. 7.2.10 SameValueZero (x,y )
      11. 7.2.11 SameValueNonNumber (x,y )
      12. 7.2.12 IsLessThan (x,y,LeftFirst )
      13. 7.2.13 IsLooselyEqual (x,y )
      14. 7.2.14 IsStrictlyEqual (x,y )
    3. +7.3 Operations on Objects
      1. 7.3.1 MakeBasicObject (internalSlotsList )
      2. 7.3.2 Get (O,P )
      3. 7.3.3 GetV (V,P )
      4. 7.3.4 Set (O,P,V,Throw )
      5. 7.3.5 CreateDataProperty (O,P,V )
      6. 7.3.6 CreateDataPropertyOrThrow (O,P,V )
      7. 7.3.7 CreateNonEnumerableDataPropertyOrThrow (O,P,V )
      8. 7.3.8 DefinePropertyOrThrow (O,P,desc )
      9. 7.3.9 DeletePropertyOrThrow (O,P )
      10. 7.3.10 GetMethod (V,P )
      11. 7.3.11 HasProperty (O,P )
      12. 7.3.12 HasOwnProperty (O,P )
      13. 7.3.13 Call (F,V [ ,argumentsList ] )
      14. 7.3.14 Construct (F [ ,argumentsList [ ,newTarget ] ] )
      15. 7.3.15 SetIntegrityLevel (O,level )
      16. 7.3.16 TestIntegrityLevel (O,level )
      17. 7.3.17 CreateArrayFromList (elements )
      18. 7.3.18 LengthOfArrayLike (obj )
      19. 7.3.19 CreateListFromArrayLike (obj [ ,validElementTypes ] )
      20. 7.3.20 Invoke (V,P [ ,argumentsList ] )
      21. 7.3.21 OrdinaryHasInstance (C,O )
      22. 7.3.22 SpeciesConstructor (O,defaultConstructor )
      23. 7.3.23 EnumerableOwnProperties (O,kind )
      24. 7.3.24 GetFunctionRealm (obj )
      25. 7.3.25 CopyDataProperties (target,source,excludedItems )
      26. 7.3.26 PrivateElementFind (O,P )
      27. 7.3.27 PrivateFieldAdd (O,P,value )
      28. 7.3.28 PrivateMethodOrAccessorAdd (O,method )
      29. 7.3.29 HostEnsureCanAddPrivateElement (O )
      30. 7.3.30 PrivateGet (O,P )
      31. 7.3.31 PrivateSet (O,P,value )
      32. 7.3.32 DefineField (receiver,fieldRecord )
      33. 7.3.33 InitializeInstanceElements (O,constructor )
      34. 7.3.34 AddValueToKeyedGroup (groups,key,value )
      35. 7.3.35 GroupBy (items,callback,keyCoercion )
      36. 7.3.36 GetOptionsObject (options )
      37. 7.3.37 SetterThatIgnoresPrototypeProperties (thisValue,home,p,v )
    4. +7.4 Operations on Iterator Objects
      1. 7.4.1 Iterator Records
      2. 7.4.2 GetIteratorDirect (obj )
      3. 7.4.3 GetIteratorFromMethod (obj,method )
      4. 7.4.4 GetIterator (obj,kind )
      5. 7.4.5 GetIteratorFlattenable (obj,primitiveHandling )
      6. 7.4.6 IteratorNext (iteratorRecord [ ,value ] )
      7. 7.4.7 IteratorComplete (iteratorResult )
      8. 7.4.8 IteratorValue (iteratorResult )
      9. 7.4.9 IteratorStep (iteratorRecord )
      10. 7.4.10 IteratorStepValue (iteratorRecord )
      11. 7.4.11 IteratorClose (iteratorRecord,completion )
      12. 7.4.12 IfAbruptCloseIterator (value,iteratorRecord )
      13. 7.4.13 AsyncIteratorClose (iteratorRecord,completion )
      14. 7.4.14 CreateIteratorResultObject (value,done )
      15. 7.4.15 CreateListIteratorRecord (list )
      16. 7.4.16 IteratorToList (iteratorRecord )
  9. +8 Syntax-Directed Operations
    1. 8.1 RS: Evaluation
    2. +8.2 Scope Analysis
      1. 8.2.1 SS: BoundNames
      2. 8.2.2 SS: DeclarationPart
      3. 8.2.3 SS: IsConstantDeclaration
      4. 8.2.4 SS: LexicallyDeclaredNames
      5. 8.2.5 SS: LexicallyScopedDeclarations
      6. 8.2.6 SS: VarDeclaredNames
      7. 8.2.7 SS: VarScopedDeclarations
      8. 8.2.8 SS: TopLevelLexicallyDeclaredNames
      9. 8.2.9 SS: TopLevelLexicallyScopedDeclarations
      10. 8.2.10 SS: TopLevelVarDeclaredNames
      11. 8.2.11 SS: TopLevelVarScopedDeclarations
    3. +8.3 Labels
      1. 8.3.1 SS: ContainsDuplicateLabels
      2. 8.3.2 SS: ContainsUndefinedBreakTarget
      3. 8.3.3 SS: ContainsUndefinedContinueTarget
    4. +8.4 Function Name Inference
      1. 8.4.1 SS: HasName
      2. 8.4.2 SS: IsFunctionDefinition
      3. 8.4.3 SS: IsAnonymousFunctionDefinition (expr )
      4. 8.4.4 SS: IsIdentifierRef
      5. 8.4.5 RS: NamedEvaluation
    5. +8.5 Contains
      1. 8.5.1 SS: Contains
      2. 8.5.2 SS: ComputedPropertyContains
    6. +8.6 Miscellaneous
      1. 8.6.1 RS: InstantiateFunctionObject
      2. +8.6.2 RS: BindingInitialization
        1. 8.6.2.1 InitializeBoundName (name,value,environment )
      3. 8.6.3 RS: IteratorBindingInitialization
      4. 8.6.4 SS: AssignmentTargetType
      5. 8.6.5 SS: PropName
  10. +9 Executable Code and Execution Contexts
    1. +9.1 Environment Records
      1. +9.1.1 The Environment Record Type Hierarchy
        1. +9.1.1.1 Declarative Environment Records
          1. 9.1.1.1.1 HasBinding (N )
          2. 9.1.1.1.2 CreateMutableBinding (N,D )
          3. 9.1.1.1.3 CreateImmutableBinding (N,S )
          4. 9.1.1.1.4 InitializeBinding (N,V )
          5. 9.1.1.1.5 SetMutableBinding (N,V,S )
          6. 9.1.1.1.6 GetBindingValue (N,S )
          7. 9.1.1.1.7 DeleteBinding (N )
          8. 9.1.1.1.8 HasThisBinding ( )
          9. 9.1.1.1.9 HasSuperBinding ( )
          10. 9.1.1.1.10 WithBaseObject ( )
        2. +9.1.1.2 Object Environment Records
          1. 9.1.1.2.1 HasBinding (N )
          2. 9.1.1.2.2 CreateMutableBinding (N,D )
          3. 9.1.1.2.3 CreateImmutableBinding (N,S )
          4. 9.1.1.2.4 InitializeBinding (N,V )
          5. 9.1.1.2.5 SetMutableBinding (N,V,S )
          6. 9.1.1.2.6 GetBindingValue (N,S )
          7. 9.1.1.2.7 DeleteBinding (N )
          8. 9.1.1.2.8 HasThisBinding ( )
          9. 9.1.1.2.9 HasSuperBinding ( )
          10. 9.1.1.2.10 WithBaseObject ( )
        3. +9.1.1.3 Function Environment Records
          1. 9.1.1.3.1 BindThisValue (envRec,V )
          2. 9.1.1.3.2 HasThisBinding ( )
          3. 9.1.1.3.3 HasSuperBinding ( )
          4. 9.1.1.3.4 GetThisBinding ( )
          5. 9.1.1.3.5 GetSuperBase (envRec )
        4. +9.1.1.4 Global Environment Records
          1. 9.1.1.4.1 HasBinding (N )
          2. 9.1.1.4.2 CreateMutableBinding (N,D )
          3. 9.1.1.4.3 CreateImmutableBinding (N,S )
          4. 9.1.1.4.4 InitializeBinding (N,V )
          5. 9.1.1.4.5 SetMutableBinding (N,V,S )
          6. 9.1.1.4.6 GetBindingValue (N,S )
          7. 9.1.1.4.7 DeleteBinding (N )
          8. 9.1.1.4.8 HasThisBinding ( )
          9. 9.1.1.4.9 HasSuperBinding ( )
          10. 9.1.1.4.10 WithBaseObject ( )
          11. 9.1.1.4.11 GetThisBinding ( )
          12. 9.1.1.4.12 HasLexicalDeclaration (envRec,N )
          13. 9.1.1.4.13 HasRestrictedGlobalProperty (envRec,N )
          14. 9.1.1.4.14 CanDeclareGlobalVar (envRec,N )
          15. 9.1.1.4.15 CanDeclareGlobalFunction (envRec,N )
          16. 9.1.1.4.16 CreateGlobalVarBinding (envRec,N,D )
          17. 9.1.1.4.17 CreateGlobalFunctionBinding (envRec,N,V,D )
        5. +9.1.1.5 Module Environment Records
          1. 9.1.1.5.1 GetBindingValue (N,S )
          2. 9.1.1.5.2 DeleteBinding (N )
          3. 9.1.1.5.3 HasThisBinding ( )
          4. 9.1.1.5.4 GetThisBinding ( )
          5. 9.1.1.5.5 CreateImportBinding (envRec,N,M,N2 )
      2. +9.1.2 Environment Record Operations
        1. 9.1.2.1 GetIdentifierReference (env,name,strict )
        2. 9.1.2.2 NewDeclarativeEnvironment (E )
        3. 9.1.2.3 NewObjectEnvironment (O,W,E )
        4. 9.1.2.4 NewFunctionEnvironment (F,newTarget )
        5. 9.1.2.5 NewGlobalEnvironment (G,thisValue )
        6. 9.1.2.6 NewModuleEnvironment (E )
    2. +9.2 PrivateEnvironment Records
      1. +9.2.1 PrivateEnvironment Record Operations
        1. 9.2.1.1 NewPrivateEnvironment (outerPrivateEnv )
        2. 9.2.1.2 ResolvePrivateIdentifier (privateEnv,identifier )
    3. +9.3 Realms
      1. 9.3.1 InitializeHostDefinedRealm ( )
      2. 9.3.2 CreateIntrinsics (realmRec )
      3. 9.3.3 SetDefaultGlobalBindings (realmRec )
    4. +9.4 Execution Contexts
      1. 9.4.1 GetActiveScriptOrModule ( )
      2. 9.4.2 ResolveBinding (name [ ,env ] )
      3. 9.4.3 GetThisEnvironment ( )
      4. 9.4.4 ResolveThisBinding ( )
      5. 9.4.5 GetNewTarget ( )
      6. 9.4.6 GetGlobalObject ( )
    5. +9.5 Jobs and Host Operations to Enqueue Jobs
      1. 9.5.1 JobCallback Records
      2. 9.5.2 HostMakeJobCallback (callback )
      3. 9.5.3 HostCallJobCallback (jobCallback,V,argumentsList )
      4. 9.5.4 HostEnqueueGenericJob (job,realm )
      5. 9.5.5 HostEnqueuePromiseJob (job,realm )
      6. 9.5.6 HostEnqueueTimeoutJob (timeoutJob,realm,milliseconds )
    6. +9.6 Agents
      1. 9.6.1 AgentSignifier ( )
      2. 9.6.2 AgentCanSuspend ( )
      3. 9.6.3 IncrementModuleAsyncEvaluationCount ( )
    7. 9.7 Agent Clusters
    8. 9.8 Forward Progress
    9. +9.9 Processing Model of WeakRef and FinalizationRegistry Targets
      1. 9.9.1 Objectives
      2. 9.9.2 Liveness
      3. 9.9.3 Execution
      4. +9.9.4 Host Hooks
        1. 9.9.4.1 HostEnqueueFinalizationRegistryCleanupJob (finalizationRegistry )
    10. 9.10 ClearKeptObjects ( )
    11. 9.11 AddToKeptObjects (value )
    12. 9.12 CleanupFinalizationRegistry (finalizationRegistry )
    13. 9.13 CanBeHeldWeakly (v )
  11. +10 Ordinary and Exotic Objects Behaviours
    1. +10.1 Ordinary Object Internal Methods and Internal Slots
      1. +10.1.1[[GetPrototypeOf]] ( )
        1. 10.1.1.1 OrdinaryGetPrototypeOf (O )
      2. +10.1.2[[SetPrototypeOf]] (V )
        1. 10.1.2.1 OrdinarySetPrototypeOf (O,V )
      3. +10.1.3[[IsExtensible]] ( )
        1. 10.1.3.1 OrdinaryIsExtensible (O )
      4. +10.1.4[[PreventExtensions]] ( )
        1. 10.1.4.1 OrdinaryPreventExtensions (O )
      5. +10.1.5[[GetOwnProperty]] (P )
        1. 10.1.5.1 OrdinaryGetOwnProperty (O,P )
      6. +10.1.6[[DefineOwnProperty]] (P,Desc )
        1. 10.1.6.1 OrdinaryDefineOwnProperty (O,P,Desc )
        2. 10.1.6.2 IsCompatiblePropertyDescriptor (Extensible,Desc,Current )
        3. 10.1.6.3 ValidateAndApplyPropertyDescriptor (O,P,extensible,Desc,current )
      7. +10.1.7[[HasProperty]] (P )
        1. 10.1.7.1 OrdinaryHasProperty (O,P )
      8. +10.1.8[[Get]] (P,Receiver )
        1. 10.1.8.1 OrdinaryGet (O,P,Receiver )
      9. +10.1.9[[Set]] (P,V,Receiver )
        1. 10.1.9.1 OrdinarySet (O,P,V,Receiver )
        2. 10.1.9.2 OrdinarySetWithOwnDescriptor (O,P,V,Receiver,ownDesc )
      10. +10.1.10[[Delete]] (P )
        1. 10.1.10.1 OrdinaryDelete (O,P )
      11. +10.1.11[[OwnPropertyKeys]] ( )
        1. 10.1.11.1 OrdinaryOwnPropertyKeys (O )
      12. 10.1.12 OrdinaryObjectCreate (proto [ ,additionalInternalSlotsList ] )
      13. 10.1.13 OrdinaryCreateFromConstructor (constructor,intrinsicDefaultProto [ ,internalSlotsList ] )
      14. 10.1.14 GetPrototypeFromConstructor (constructor,intrinsicDefaultProto )
      15. 10.1.15 RequireInternalSlot (O,internalSlot )
    2. +10.2 ECMAScript Function Objects
      1. +10.2.1[[Call]] (thisArgument,argumentsList )
        1. 10.2.1.1 PrepareForOrdinaryCall (F,newTarget )
        2. 10.2.1.2 OrdinaryCallBindThis (F,calleeContext,thisArgument )
        3. 10.2.1.3 RS: EvaluateBody
        4. 10.2.1.4 OrdinaryCallEvaluateBody (F,argumentsList )
      2. 10.2.2[[Construct]] (argumentsList,newTarget )
      3. 10.2.3 OrdinaryFunctionCreate (functionPrototype,sourceText,ParameterList,Body,thisMode,env,privateEnv )
      4. +10.2.4 AddRestrictedFunctionProperties (F,realm )
        1. 10.2.4.1 %ThrowTypeError% ( )
      5. 10.2.5 MakeConstructor (F [ ,writablePrototype [ ,prototype ] ] )
      6. 10.2.6 MakeClassConstructor (F )
      7. 10.2.7 MakeMethod (F,homeObject )
      8. 10.2.8 DefineMethodProperty (homeObject,key,closure,enumerable )
      9. 10.2.9 SetFunctionName (F,name [ ,prefix ] )
      10. 10.2.10 SetFunctionLength (F,length )
      11. 10.2.11 FunctionDeclarationInstantiation (func,argumentsList )
    3. +10.3 Built-in Function Objects
      1. 10.3.1[[Call]] (thisArgument,argumentsList )
      2. 10.3.2[[Construct]] (argumentsList,newTarget )
      3. 10.3.3 BuiltinCallOrConstruct (F,thisArgument,argumentsList,newTarget )
      4. 10.3.4 CreateBuiltinFunction (behaviour,length,name,additionalInternalSlotsList [ ,realm [ ,prototype [ ,prefix ] ] ] )
    4. +10.4 Built-in Exotic Object Internal Methods and Slots
      1. +10.4.1 Bound Function Exotic Objects
        1. 10.4.1.1[[Call]] (thisArgument,argumentsList )
        2. 10.4.1.2[[Construct]] (argumentsList,newTarget )
        3. 10.4.1.3 BoundFunctionCreate (targetFunction,boundThis,boundArgs )
      2. +10.4.2 Array Exotic Objects
        1. 10.4.2.1[[DefineOwnProperty]] (P,Desc )
        2. 10.4.2.2 ArrayCreate (length [ ,proto ] )
        3. 10.4.2.3 ArraySpeciesCreate (originalArray,length )
        4. 10.4.2.4 ArraySetLength (A,Desc )
      3. +10.4.3 String Exotic Objects
        1. 10.4.3.1[[GetOwnProperty]] (P )
        2. 10.4.3.2[[DefineOwnProperty]] (P,Desc )
        3. 10.4.3.3[[OwnPropertyKeys]] ( )
        4. 10.4.3.4 StringCreate (value,prototype )
        5. 10.4.3.5 StringGetOwnProperty (S,P )
      4. +10.4.4 Arguments Exotic Objects
        1. 10.4.4.1[[GetOwnProperty]] (P )
        2. 10.4.4.2[[DefineOwnProperty]] (P,Desc )
        3. 10.4.4.3[[Get]] (P,Receiver )
        4. 10.4.4.4[[Set]] (P,V,Receiver )
        5. 10.4.4.5[[Delete]] (P )
        6. 10.4.4.6 CreateUnmappedArgumentsObject (argumentsList )
        7. +10.4.4.7 CreateMappedArgumentsObject (func,formals,argumentsList,env )
          1. 10.4.4.7.1 MakeArgGetter (name,env )
          2. 10.4.4.7.2 MakeArgSetter (name,env )
      5. +10.4.5 TypedArray Exotic Objects
        1. 10.4.5.1[[PreventExtensions]] ( )
        2. 10.4.5.2[[GetOwnProperty]] (P )
        3. 10.4.5.3[[HasProperty]] (P )
        4. 10.4.5.4[[DefineOwnProperty]] (P,Desc )
        5. 10.4.5.5[[Get]] (P,Receiver )
        6. 10.4.5.6[[Set]] (P,V,Receiver )
        7. 10.4.5.7[[Delete]] (P )
        8. 10.4.5.8[[OwnPropertyKeys]] ( )
        9. 10.4.5.9 TypedArray With Buffer Witness Records
        10. 10.4.5.10 MakeTypedArrayWithBufferWitnessRecord (obj,order )
        11. 10.4.5.11 TypedArrayCreate (prototype )
        12. 10.4.5.12 TypedArrayByteLength (taRecord )
        13. 10.4.5.13 TypedArrayLength (taRecord )
        14. 10.4.5.14 IsTypedArrayOutOfBounds (taRecord )
        15. 10.4.5.15 IsTypedArrayFixedLength (O )
        16. 10.4.5.16 IsValidIntegerIndex (O,index )
        17. 10.4.5.17 TypedArrayGetElement (O,index )
        18. 10.4.5.18 TypedArraySetElement (O,index,value )
        19. 10.4.5.19 IsArrayBufferViewOutOfBounds (O )
      6. +10.4.6 Module Namespace Exotic Objects
        1. 10.4.6.1[[GetPrototypeOf]] ( )
        2. 10.4.6.2[[SetPrototypeOf]] (V )
        3. 10.4.6.3[[IsExtensible]] ( )
        4. 10.4.6.4[[PreventExtensions]] ( )
        5. 10.4.6.5[[GetOwnProperty]] (P )
        6. 10.4.6.6[[DefineOwnProperty]] (P,Desc )
        7. 10.4.6.7[[HasProperty]] (P )
        8. 10.4.6.8[[Get]] (P,Receiver )
        9. 10.4.6.9[[Set]] (P,V,Receiver )
        10. 10.4.6.10[[Delete]] (P )
        11. 10.4.6.11[[OwnPropertyKeys]] ( )
        12. 10.4.6.12 ModuleNamespaceCreate (module,exports )
      7. +10.4.7 Immutable Prototype Exotic Objects
        1. 10.4.7.1[[SetPrototypeOf]] (V )
        2. 10.4.7.2 SetImmutablePrototype (O,V )
    5. +10.5 Proxy Object Internal Methods and Internal Slots
      1. 10.5.1[[GetPrototypeOf]] ( )
      2. 10.5.2[[SetPrototypeOf]] (V )
      3. 10.5.3[[IsExtensible]] ( )
      4. 10.5.4[[PreventExtensions]] ( )
      5. 10.5.5[[GetOwnProperty]] (P )
      6. 10.5.6[[DefineOwnProperty]] (P,Desc )
      7. 10.5.7[[HasProperty]] (P )
      8. 10.5.8[[Get]] (P,Receiver )
      9. 10.5.9[[Set]] (P,V,Receiver )
      10. 10.5.10[[Delete]] (P )
      11. 10.5.11[[OwnPropertyKeys]] ( )
      12. 10.5.12[[Call]] (thisArgument,argumentsList )
      13. 10.5.13[[Construct]] (argumentsList,newTarget )
      14. 10.5.14 ValidateNonRevokedProxy (proxy )
      15. 10.5.15 ProxyCreate (target,handler )
  12. +11 ECMAScript Language: Source Text
    1. +11.1 Source Text
      1. 11.1.1 SS: UTF16EncodeCodePoint (cp )
      2. 11.1.2 SS: CodePointsToString (text )
      3. 11.1.3 SS: UTF16SurrogatePairToCodePoint (lead,trail )
      4. 11.1.4 SS: CodePointAt (string,position )
      5. 11.1.5 SS: StringToCodePoints (string )
      6. 11.1.6 SS: ParseText (sourceText,goalSymbol )
    2. +11.2 Types of Source Code
      1. 11.2.1 Directive Prologues and the Use Strict Directive
      2. +11.2.2 Strict Mode Code
        1. 11.2.2.1 SS: IsStrict (node )
      3. 11.2.3 Non-ECMAScript Functions
  13. +12 ECMAScript Language: Lexical Grammar
    1. 12.1 Unicode Format-Control Characters
    2. 12.2 White Space
    3. 12.3 Line Terminators
    4. 12.4 Comments
    5. 12.5 Hashbang Comments
    6. 12.6 Tokens
    7. +12.7 Names and Keywords
      1. +12.7.1 Identifier Names
        1. 12.7.1.1 SS: Early Errors
        2. 12.7.1.2 SS: IdentifierCodePoints
        3. 12.7.1.3 SS: IdentifierCodePoint
      2. 12.7.2 Keywords and Reserved Words
    8. 12.8 Punctuators
    9. +12.9 Literals
      1. 12.9.1 Null Literals
      2. 12.9.2 Boolean Literals
      3. +12.9.3 Numeric Literals
        1. 12.9.3.1 SS: Early Errors
        2. 12.9.3.2 SS: MV
        3. 12.9.3.3 SS: NumericValue
      4. +12.9.4 String Literals
        1. 12.9.4.1 SS: Early Errors
        2. 12.9.4.2 SS: SV
        3. 12.9.4.3 SS: MV
      5. +12.9.5 Regular Expression Literals
        1. 12.9.5.1 SS: BodyText
        2. 12.9.5.2 SS: FlagText
      6. +12.9.6 Template Literal Lexical Components
        1. 12.9.6.1 SS: TV
        2. 12.9.6.2 SS: TRV
    10. +12.10 Automatic Semicolon Insertion
      1. 12.10.1 Rules of Automatic Semicolon Insertion
      2. 12.10.2 Examples of Automatic Semicolon Insertion
      3. +12.10.3 Interesting Cases of Automatic Semicolon Insertion
        1. 12.10.3.1 Interesting Cases of Automatic Semicolon Insertion in Statement Lists
        2. +12.10.3.2 Cases of Automatic Semicolon Insertion and “[noLineTerminator here]”
          1. 12.10.3.2.1 List of Grammar Productions with Optional Operands and “[noLineTerminator here]”
  14. +13 ECMAScript Language: Expressions
    1. +13.1 Identifiers
      1. 13.1.1 SS: Early Errors
      2. 13.1.2 SS: StringValue
      3. 13.1.3 RS: Evaluation
    2. +13.2 Primary Expression
      1. +13.2.1 Thethis Keyword
        1. 13.2.1.1 RS: Evaluation
      2. 13.2.2 Identifier Reference
      3. +13.2.3 Literals
        1. 13.2.3.1 RS: Evaluation
      4. +13.2.4 Array Initializer
        1. 13.2.4.1 RS: ArrayAccumulation
        2. 13.2.4.2 RS: Evaluation
      5. +13.2.5 Object Initializer
        1. 13.2.5.1 SS: Early Errors
        2. 13.2.5.2 SS: IsComputedPropertyKey
        3. 13.2.5.3 SS: PropertyNameList
        4. 13.2.5.4 RS: Evaluation
        5. 13.2.5.5 RS: PropertyDefinitionEvaluation
      6. 13.2.6 Function Defining Expressions
      7. +13.2.7 Regular Expression Literals
        1. 13.2.7.1 SS: Early Errors
        2. 13.2.7.2 SS: IsValidRegularExpressionLiteral (literal )
        3. 13.2.7.3 RS: Evaluation
      8. +13.2.8 Template Literals
        1. 13.2.8.1 SS: Early Errors
        2. 13.2.8.2 SS: TemplateStrings
        3. 13.2.8.3 SS: TemplateString (templateToken,raw )
        4. 13.2.8.4 GetTemplateObject (templateLiteral )
        5. 13.2.8.5 RS: SubstitutionEvaluation
        6. 13.2.8.6 RS: Evaluation
      9. +13.2.9 The Grouping Operator
        1. 13.2.9.1 SS: Early Errors
        2. 13.2.9.2 RS: Evaluation
    3. +13.3 Left-Hand-Side Expressions
      1. +13.3.1 Static Semantics
        1. 13.3.1.1 SS: Early Errors
      2. +13.3.2 Property Accessors
        1. 13.3.2.1 RS: Evaluation
      3. 13.3.3 EvaluatePropertyAccessWithExpressionKey (baseValue,expression,strict )
      4. 13.3.4 EvaluatePropertyAccessWithIdentifierKey (baseValue,identifierName,strict )
      5. +13.3.5 Thenew Operator
        1. +13.3.5.1 RS: Evaluation
          1. 13.3.5.1.1 EvaluateNew (constructExpr,arguments )
      6. +13.3.6 Function Calls
        1. 13.3.6.1 RS: Evaluation
        2. 13.3.6.2 EvaluateCall (func,ref,arguments,tailPosition )
      7. +13.3.7 Thesuper Keyword
        1. 13.3.7.1 RS: Evaluation
        2. 13.3.7.2 GetSuperConstructor ( )
        3. 13.3.7.3 MakeSuperPropertyReference (actualThis,propertyKey,strict )
      8. +13.3.8 Argument Lists
        1. 13.3.8.1 RS: ArgumentListEvaluation
      9. +13.3.9 Optional Chains
        1. 13.3.9.1 RS: Evaluation
        2. 13.3.9.2 RS: ChainEvaluation
      10. +13.3.10 Import Calls
        1. 13.3.10.1 RS: Evaluation
        2. 13.3.10.2 EvaluateImportCall (specifierExpression [ ,optionsExpression ] )
        3. 13.3.10.3 ContinueDynamicImport (promiseCapability,moduleCompletion )
      11. +13.3.11 Tagged Templates
        1. 13.3.11.1 RS: Evaluation
      12. +13.3.12 Meta Properties
        1. +13.3.12.1 RS: Evaluation
          1. 13.3.12.1.1 HostGetImportMetaProperties (moduleRecord )
          2. 13.3.12.1.2 HostFinalizeImportMeta (importMeta,moduleRecord )
    4. +13.4 Update Expressions
      1. 13.4.1 SS: Early Errors
      2. +13.4.2 Postfix Increment Operator
        1. 13.4.2.1 RS: Evaluation
      3. +13.4.3 Postfix Decrement Operator
        1. 13.4.3.1 RS: Evaluation
      4. +13.4.4 Prefix Increment Operator
        1. 13.4.4.1 RS: Evaluation
      5. +13.4.5 Prefix Decrement Operator
        1. 13.4.5.1 RS: Evaluation
    5. +13.5 Unary Operators
      1. +13.5.1 Thedelete Operator
        1. 13.5.1.1 SS: Early Errors
        2. 13.5.1.2 RS: Evaluation
      2. +13.5.2 Thevoid Operator
        1. 13.5.2.1 RS: Evaluation
      3. +13.5.3 Thetypeof Operator
        1. 13.5.3.1 RS: Evaluation
      4. +13.5.4 Unary+ Operator
        1. 13.5.4.1 RS: Evaluation
      5. +13.5.5 Unary- Operator
        1. 13.5.5.1 RS: Evaluation
      6. +13.5.6 Bitwise NOT Operator (~ )
        1. 13.5.6.1 RS: Evaluation
      7. +13.5.7 Logical NOT Operator (! )
        1. 13.5.7.1 RS: Evaluation
    6. +13.6 Exponentiation Operator
      1. 13.6.1 RS: Evaluation
    7. +13.7 Multiplicative Operators
      1. 13.7.1 RS: Evaluation
    8. +13.8 Additive Operators
      1. +13.8.1 The Addition Operator (+ )
        1. 13.8.1.1 RS: Evaluation
      2. +13.8.2 The Subtraction Operator (- )
        1. 13.8.2.1 RS: Evaluation
    9. +13.9 Bitwise Shift Operators
      1. +13.9.1 The Left Shift Operator (<< )
        1. 13.9.1.1 RS: Evaluation
      2. +13.9.2 The Signed Right Shift Operator (>> )
        1. 13.9.2.1 RS: Evaluation
      3. +13.9.3 The Unsigned Right Shift Operator (>>> )
        1. 13.9.3.1 RS: Evaluation
    10. +13.10 Relational Operators
      1. 13.10.1 RS: Evaluation
      2. 13.10.2 InstanceofOperator (V,target )
    11. +13.11 Equality Operators
      1. 13.11.1 RS: Evaluation
    12. +13.12 Binary Bitwise Operators
      1. 13.12.1 RS: Evaluation
    13. +13.13 Binary Logical Operators
      1. 13.13.1 RS: Evaluation
    14. +13.14 Conditional Operator (? : )
      1. 13.14.1 RS: Evaluation
    15. +13.15 Assignment Operators
      1. 13.15.1 SS: Early Errors
      2. 13.15.2 RS: Evaluation
      3. 13.15.3 ApplyStringOrNumericBinaryOperator (lVal,opText,rVal )
      4. 13.15.4 EvaluateStringOrNumericBinaryExpression (leftOperand,opText,rightOperand )
      5. +13.15.5 Destructuring Assignment
        1. 13.15.5.1 SS: Early Errors
        2. 13.15.5.2 RS: DestructuringAssignmentEvaluation
        3. 13.15.5.3 RS: PropertyDestructuringAssignmentEvaluation
        4. 13.15.5.4 RS: RestDestructuringAssignmentEvaluation
        5. 13.15.5.5 RS: IteratorDestructuringAssignmentEvaluation
        6. 13.15.5.6 RS: KeyedDestructuringAssignmentEvaluation
    16. +13.16 Comma Operator (, )
      1. 13.16.1 RS: Evaluation
  15. +14 ECMAScript Language: Statements and Declarations
    1. +14.1 Statement Semantics
      1. 14.1.1 RS: Evaluation
    2. +14.2 Block
      1. 14.2.1 SS: Early Errors
      2. 14.2.2 RS: Evaluation
      3. 14.2.3 BlockDeclarationInstantiation (code,env )
    3. +14.3 Declarations and the Variable Statement
      1. +14.3.1 Let and Const Declarations
        1. 14.3.1.1 SS: Early Errors
        2. 14.3.1.2 RS: Evaluation
      2. +14.3.2 Variable Statement
        1. 14.3.2.1 RS: Evaluation
      3. +14.3.3 Destructuring Binding Patterns
        1. 14.3.3.1 RS: PropertyBindingInitialization
        2. 14.3.3.2 RS: RestBindingInitialization
        3. 14.3.3.3 RS: KeyedBindingInitialization
    4. +14.4 Empty Statement
      1. 14.4.1 RS: Evaluation
    5. +14.5 Expression Statement
      1. 14.5.1 RS: Evaluation
    6. +14.6 Theif Statement
      1. 14.6.1 SS: Early Errors
      2. 14.6.2 RS: Evaluation
    7. +14.7 Iteration Statements
      1. +14.7.1 Semantics
        1. 14.7.1.1 LoopContinues (completion,labelSet )
        2. 14.7.1.2 RS: LoopEvaluation
      2. +14.7.2 Thedo-while Statement
        1. 14.7.2.1 SS: Early Errors
        2. 14.7.2.2 RS: DoWhileLoopEvaluation
      3. +14.7.3 Thewhile Statement
        1. 14.7.3.1 SS: Early Errors
        2. 14.7.3.2 RS: WhileLoopEvaluation
      4. +14.7.4 Thefor Statement
        1. 14.7.4.1 SS: Early Errors
        2. 14.7.4.2 RS: ForLoopEvaluation
        3. 14.7.4.3 ForBodyEvaluation (test,increment,stmt,perIterationBindings,labelSet )
        4. 14.7.4.4 CreatePerIterationEnvironment (perIterationBindings )
      5. +14.7.5 Thefor-in,for-of, andfor-await-of Statements
        1. 14.7.5.1 SS: Early Errors
        2. 14.7.5.2 SS: IsDestructuring
        3. 14.7.5.3 RS: ForDeclarationBindingInitialization
        4. 14.7.5.4 RS: ForDeclarationBindingInstantiation
        5. 14.7.5.5 RS: ForInOfLoopEvaluation
        6. 14.7.5.6 ForIn/OfHeadEvaluation (uninitializedBoundNames,expr,iterationKind )
        7. 14.7.5.7 ForIn/OfBodyEvaluation (lhs,stmt,iteratorRecord,iterationKind,lhsKind,labelSet [ ,iteratorKind ] )
        8. 14.7.5.8 RS: Evaluation
        9. 14.7.5.9 EnumerateObjectProperties (O )
        10. +14.7.5.10 For-In Iterator Objects
          1. 14.7.5.10.1 CreateForInIterator (object )
          2. +14.7.5.10.2 The %ForInIteratorPrototype% Object
            1. 14.7.5.10.2.1 %ForInIteratorPrototype%.next ( )
          3. 14.7.5.10.3 Properties of For-In Iterator Instances
    8. +14.8 Thecontinue Statement
      1. 14.8.1 SS: Early Errors
      2. 14.8.2 RS: Evaluation
    9. +14.9 Thebreak Statement
      1. 14.9.1 SS: Early Errors
      2. 14.9.2 RS: Evaluation
    10. +14.10 Thereturn Statement
      1. 14.10.1 RS: Evaluation
    11. +14.11 Thewith Statement
      1. 14.11.1 SS: Early Errors
      2. 14.11.2 RS: Evaluation
    12. +14.12 Theswitch Statement
      1. 14.12.1 SS: Early Errors
      2. 14.12.2 RS: CaseBlockEvaluation
      3. 14.12.3 CaseClauseIsSelected (C,input )
      4. 14.12.4 RS: Evaluation
    13. +14.13 Labelled Statements
      1. 14.13.1 SS: Early Errors
      2. 14.13.2 SS: IsLabelledFunction (stmt )
      3. 14.13.3 RS: Evaluation
      4. 14.13.4 RS: LabelledEvaluation
    14. +14.14 Thethrow Statement
      1. 14.14.1 RS: Evaluation
    15. +14.15 Thetry Statement
      1. 14.15.1 SS: Early Errors
      2. 14.15.2 RS: CatchClauseEvaluation
      3. 14.15.3 RS: Evaluation
    16. +14.16 Thedebugger Statement
      1. 14.16.1 RS: Evaluation
  16. +15 ECMAScript Language: Functions and Classes
    1. +15.1 Parameter Lists
      1. 15.1.1 SS: Early Errors
      2. 15.1.2 SS: ContainsExpression
      3. 15.1.3 SS: IsSimpleParameterList
      4. 15.1.4 SS: HasInitializer
      5. 15.1.5 SS: ExpectedArgumentCount
    2. +15.2 Function Definitions
      1. 15.2.1 SS: Early Errors
      2. 15.2.2 SS: FunctionBodyContainsUseStrict
      3. 15.2.3 RS: EvaluateFunctionBody
      4. 15.2.4 RS: InstantiateOrdinaryFunctionObject
      5. 15.2.5 RS: InstantiateOrdinaryFunctionExpression
      6. 15.2.6 RS: Evaluation
    3. +15.3 Arrow Function Definitions
      1. 15.3.1 SS: Early Errors
      2. 15.3.2 SS: ConciseBodyContainsUseStrict
      3. 15.3.3 RS: EvaluateConciseBody
      4. 15.3.4 RS: InstantiateArrowFunctionExpression
      5. 15.3.5 RS: Evaluation
    4. +15.4 Method Definitions
      1. 15.4.1 SS: Early Errors
      2. 15.4.2 SS: HasDirectSuper
      3. 15.4.3 SS: SpecialMethod
      4. 15.4.4 RS: DefineMethod
      5. 15.4.5 RS: MethodDefinitionEvaluation
    5. +15.5 Generator Function Definitions
      1. 15.5.1 SS: Early Errors
      2. 15.5.2 RS: EvaluateGeneratorBody
      3. 15.5.3 RS: InstantiateGeneratorFunctionObject
      4. 15.5.4 RS: InstantiateGeneratorFunctionExpression
      5. 15.5.5 RS: Evaluation
    6. +15.6 Async Generator Function Definitions
      1. 15.6.1 SS: Early Errors
      2. 15.6.2 RS: EvaluateAsyncGeneratorBody
      3. 15.6.3 RS: InstantiateAsyncGeneratorFunctionObject
      4. 15.6.4 RS: InstantiateAsyncGeneratorFunctionExpression
      5. 15.6.5 RS: Evaluation
    7. +15.7 Class Definitions
      1. 15.7.1 SS: Early Errors
      2. 15.7.2 SS: ClassElementKind
      3. 15.7.3 SS: ConstructorMethod
      4. 15.7.4 SS: IsStatic
      5. 15.7.5 SS: NonConstructorElements
      6. 15.7.6 SS: PrototypePropertyNameList
      7. 15.7.7 SS: AllPrivateIdentifiersValid
      8. 15.7.8 SS: PrivateBoundIdentifiers
      9. 15.7.9 SS: ContainsArguments
      10. 15.7.10 RS: ClassFieldDefinitionEvaluation
      11. 15.7.11 RS: ClassStaticBlockDefinitionEvaluation
      12. 15.7.12 RS: EvaluateClassStaticBlockBody
      13. 15.7.13 RS: ClassElementEvaluation
      14. 15.7.14 RS: ClassDefinitionEvaluation
      15. 15.7.15 RS: BindingClassDeclarationEvaluation
      16. 15.7.16 RS: Evaluation
    8. +15.8 Async Function Definitions
      1. 15.8.1 SS: Early Errors
      2. 15.8.2 RS: InstantiateAsyncFunctionObject
      3. 15.8.3 RS: InstantiateAsyncFunctionExpression
      4. 15.8.4 RS: EvaluateAsyncFunctionBody
      5. 15.8.5 RS: Evaluation
    9. +15.9 Async Arrow Function Definitions
      1. 15.9.1 SS: Early Errors
      2. 15.9.2 SS: AsyncConciseBodyContainsUseStrict
      3. 15.9.3 RS: EvaluateAsyncConciseBody
      4. 15.9.4 RS: InstantiateAsyncArrowFunctionExpression
      5. 15.9.5 RS: Evaluation
    10. +15.10 Tail Position Calls
      1. 15.10.1 SS: IsInTailPosition (call )
      2. 15.10.2 SS: HasCallInTailPosition
      3. 15.10.3 PrepareForTailCall ( )
  17. +16 ECMAScript Language: Scripts and Modules
    1. +16.1 Scripts
      1. 16.1.1 SS: Early Errors
      2. 16.1.2 SS: ScriptIsStrict
      3. 16.1.3 RS: Evaluation
      4. 16.1.4 Script Records
      5. 16.1.5 ParseScript (sourceText,realm,hostDefined )
      6. 16.1.6 ScriptEvaluation (scriptRecord )
      7. 16.1.7 GlobalDeclarationInstantiation (script,env )
    2. +16.2 Modules
      1. +16.2.1 Module Semantics
        1. 16.2.1.1 SS: Early Errors
        2. 16.2.1.2 SS: ImportedLocalNames (importEntries )
        3. +16.2.1.3 ModuleRequest Records
          1. 16.2.1.3.1 ModuleRequestsEqual (left,right )
        4. 16.2.1.4 SS: ModuleRequests
        5. +16.2.1.5 Abstract Module Records
          1. 16.2.1.5.1 EvaluateModuleSync (module )
        6. +16.2.1.6 Cyclic Module Records
          1. +16.2.1.6.1 Implementation of Module Record Abstract Methods
            1. +16.2.1.6.1.1 LoadRequestedModules ( [hostDefined ] )
              1. 16.2.1.6.1.1.1 InnerModuleLoading (state,module )
              2. 16.2.1.6.1.1.2 ContinueModuleLoading (state,moduleCompletion )
            2. +16.2.1.6.1.2 Link ( )
              1. 16.2.1.6.1.2.1 InnerModuleLinking (module,stack,index )
            3. +16.2.1.6.1.3 Evaluate ( )
              1. 16.2.1.6.1.3.1 InnerModuleEvaluation (module,stack,index )
              2. 16.2.1.6.1.3.2 ExecuteAsyncModule (module )
              3. 16.2.1.6.1.3.3 GatherAvailableAncestors (module,execList )
              4. 16.2.1.6.1.3.4 AsyncModuleExecutionFulfilled (module )
              5. 16.2.1.6.1.3.5 AsyncModuleExecutionRejected (module,error )
          2. 16.2.1.6.2 Example Cyclic Module Record Graphs
        7. +16.2.1.7 Source Text Module Records
          1. 16.2.1.7.1 ParseModule (sourceText,realm,hostDefined )
          2. +16.2.1.7.2 Implementation of Module Record Abstract Methods
            1. 16.2.1.7.2.1 GetExportedNames ( [exportStarSet ] )
            2. 16.2.1.7.2.2 ResolveExport (exportName [ ,resolveSet ] )
          3. +16.2.1.7.3 Implementation of Cyclic Module Record Abstract Methods
            1. 16.2.1.7.3.1 InitializeEnvironment ( )
            2. 16.2.1.7.3.2 ExecuteModule ( [capability ] )
        8. +16.2.1.8 Synthetic Module Records
          1. 16.2.1.8.1 CreateDefaultExportSyntheticModule (defaultExport )
          2. 16.2.1.8.2 ParseJSONModule (source )
          3. 16.2.1.8.3 SetSyntheticModuleExport (module,exportName,exportValue )
          4. +16.2.1.8.4 Implementation of Module Record Abstract Methods
            1. 16.2.1.8.4.1 LoadRequestedModules ( )
            2. 16.2.1.8.4.2 GetExportedNames ( )
            3. 16.2.1.8.4.3 ResolveExport (exportName )
            4. 16.2.1.8.4.4 Link ( )
            5. 16.2.1.8.4.5 Evaluate ( )
        9. 16.2.1.9 GetImportedModule (referrer,request )
        10. 16.2.1.10 HostLoadImportedModule (referrer,moduleRequest,hostDefined,payload )
        11. 16.2.1.11 FinishLoadingImportedModule (referrer,moduleRequest,payload,result )
        12. +16.2.1.12 AllImportAttributesSupported (attributes )
          1. 16.2.1.12.1 HostGetSupportedImportAttributes ( )
        13. 16.2.1.13 GetModuleNamespace (module )
        14. 16.2.1.14 RS: Evaluation
      2. +16.2.2 Imports
        1. 16.2.2.1 SS: Early Errors
        2. 16.2.2.2 SS: ImportEntries
        3. 16.2.2.3 SS: ImportEntriesForModule
        4. 16.2.2.4 SS: WithClauseToAttributes
      3. +16.2.3 Exports
        1. 16.2.3.1 SS: Early Errors
        2. 16.2.3.2 SS: ExportedBindings
        3. 16.2.3.3 SS: ExportedNames
        4. 16.2.3.4 SS: ExportEntries
        5. 16.2.3.5 SS: ExportEntriesForModule
        6. 16.2.3.6 SS: ReferencedBindings
        7. 16.2.3.7 RS: Evaluation
  18. +17 Error Handling and Language Extensions
    1. 17.1 Forbidden Extensions
  19. 18 ECMAScript Standard Built-in Objects
  20. +19 The Global Object
    1. +19.1 Value Properties of the Global Object
      1. 19.1.1 globalThis
      2. 19.1.2 Infinity
      3. 19.1.3 NaN
      4. 19.1.4 undefined
    2. +19.2 Function Properties of the Global Object
      1. +19.2.1 eval (x )
        1. 19.2.1.1 PerformEval (x,strictCaller,direct )
        2. 19.2.1.2 HostEnsureCanCompileStrings (calleeRealm,parameterStrings,bodyString,direct )
        3. 19.2.1.3 EvalDeclarationInstantiation (body,varEnv,lexEnv,privateEnv,strict )
      2. 19.2.2 isFinite (number )
      3. 19.2.3 isNaN (number )
      4. 19.2.4 parseFloat (string )
      5. 19.2.5 parseInt (string,radix )
      6. +19.2.6 URI Handling Functions
        1. 19.2.6.1 decodeURI (encodedURI )
        2. 19.2.6.2 decodeURIComponent (encodedURIComponent )
        3. 19.2.6.3 encodeURI (uri )
        4. 19.2.6.4 encodeURIComponent (uriComponent )
        5. 19.2.6.5 Encode (string,extraUnescaped )
        6. 19.2.6.6 Decode (string,preserveEscapeSet )
        7. 19.2.6.7 ParseHexOctet (string,position )
    3. +19.3 Constructor Properties of the Global Object
      1. 19.3.1 AggregateError ( . . . )
      2. 19.3.2 Array ( . . . )
      3. 19.3.3 ArrayBuffer ( . . . )
      4. 19.3.4 BigInt ( . . . )
      5. 19.3.5 BigInt64Array ( . . . )
      6. 19.3.6 BigUint64Array ( . . . )
      7. 19.3.7 Boolean ( . . . )
      8. 19.3.8 DataView ( . . . )
      9. 19.3.9 Date ( . . . )
      10. 19.3.10 Error ( . . . )
      11. 19.3.11 EvalError ( . . . )
      12. 19.3.12 FinalizationRegistry ( . . . )
      13. 19.3.13 Float16Array ( . . . )
      14. 19.3.14 Float32Array ( . . . )
      15. 19.3.15 Float64Array ( . . . )
      16. 19.3.16 Function ( . . . )
      17. 19.3.17 Int8Array ( . . . )
      18. 19.3.18 Int16Array ( . . . )
      19. 19.3.19 Int32Array ( . . . )
      20. 19.3.20 Iterator ( . . . )
      21. 19.3.21 Map ( . . . )
      22. 19.3.22 Number ( . . . )
      23. 19.3.23 Object ( . . . )
      24. 19.3.24 Promise ( . . . )
      25. 19.3.25 Proxy ( . . . )
      26. 19.3.26 RangeError ( . . . )
      27. 19.3.27 ReferenceError ( . . . )
      28. 19.3.28 RegExp ( . . . )
      29. 19.3.29 Set ( . . . )
      30. 19.3.30 SharedArrayBuffer ( . . . )
      31. 19.3.31 String ( . . . )
      32. 19.3.32 Symbol ( . . . )
      33. 19.3.33 SyntaxError ( . . . )
      34. 19.3.34 TypeError ( . . . )
      35. 19.3.35 Uint8Array ( . . . )
      36. 19.3.36 Uint8ClampedArray ( . . . )
      37. 19.3.37 Uint16Array ( . . . )
      38. 19.3.38 Uint32Array ( . . . )
      39. 19.3.39 URIError ( . . . )
      40. 19.3.40 WeakMap ( . . . )
      41. 19.3.41 WeakRef ( . . . )
      42. 19.3.42 WeakSet ( . . . )
    4. +19.4 Other Properties of the Global Object
      1. 19.4.1 Atomics
      2. 19.4.2 JSON
      3. 19.4.3 Math
      4. 19.4.4 Reflect
  21. +20 Fundamental Objects
    1. +20.1 Object Objects
      1. +20.1.1 The Object Constructor
        1. 20.1.1.1 Object ( [value ] )
      2. +20.1.2 Properties of the Object Constructor
        1. 20.1.2.1 Object.assign (target, ...sources )
        2. 20.1.2.2 Object.create (O,Properties )
        3. +20.1.2.3 Object.defineProperties (O,Properties )
          1. 20.1.2.3.1 ObjectDefineProperties (O,Properties )
        4. 20.1.2.4 Object.defineProperty (O,P,Attributes )
        5. 20.1.2.5 Object.entries (O )
        6. 20.1.2.6 Object.freeze (O )
        7. 20.1.2.7 Object.fromEntries (iterable )
        8. 20.1.2.8 Object.getOwnPropertyDescriptor (O,P )
        9. 20.1.2.9 Object.getOwnPropertyDescriptors (O )
        10. 20.1.2.10 Object.getOwnPropertyNames (O )
        11. +20.1.2.11 Object.getOwnPropertySymbols (O )
          1. 20.1.2.11.1 GetOwnPropertyKeys (O,type )
        12. 20.1.2.12 Object.getPrototypeOf (O )
        13. 20.1.2.13 Object.groupBy (items,callback )
        14. 20.1.2.14 Object.hasOwn (O,P )
        15. 20.1.2.15 Object.is (value1,value2 )
        16. 20.1.2.16 Object.isExtensible (O )
        17. 20.1.2.17 Object.isFrozen (O )
        18. 20.1.2.18 Object.isSealed (O )
        19. 20.1.2.19 Object.keys (O )
        20. 20.1.2.20 Object.preventExtensions (O )
        21. 20.1.2.21 Object.prototype
        22. 20.1.2.22 Object.seal (O )
        23. 20.1.2.23 Object.setPrototypeOf (O,proto )
        24. 20.1.2.24 Object.values (O )
      3. +20.1.3 Properties of the Object Prototype Object
        1. 20.1.3.1 Object.prototype.constructor
        2. 20.1.3.2 Object.prototype.hasOwnProperty (V )
        3. 20.1.3.3 Object.prototype.isPrototypeOf (V )
        4. 20.1.3.4 Object.prototype.propertyIsEnumerable (V )
        5. 20.1.3.5 Object.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )
        6. 20.1.3.6 Object.prototype.toString ( )
        7. 20.1.3.7 Object.prototype.valueOf ( )
        8. +20.1.3.8 Object.prototype.__proto__
          1. 20.1.3.8.1 get Object.prototype.__proto__
          2. 20.1.3.8.2 set Object.prototype.__proto__
        9. +20.1.3.9 Legacy Object.prototype Accessor Methods
          1. 20.1.3.9.1 Object.prototype.__defineGetter__ (P,getter )
          2. 20.1.3.9.2 Object.prototype.__defineSetter__ (P,setter )
          3. 20.1.3.9.3 Object.prototype.__lookupGetter__ (P )
          4. 20.1.3.9.4 Object.prototype.__lookupSetter__ (P )
      4. 20.1.4 Properties of Object Instances
    2. +20.2 Function Objects
      1. +20.2.1 The Function Constructor
        1. +20.2.1.1 Function ( ...parameterArgs,bodyArg )
          1. 20.2.1.1.1 CreateDynamicFunction (constructor,newTarget,kind,parameterArgs,bodyArg )
      2. +20.2.2 Properties of the Function Constructor
        1. 20.2.2.1 Function.prototype
      3. +20.2.3 Properties of the Function Prototype Object
        1. 20.2.3.1 Function.prototype.apply (thisArg,argArray )
        2. 20.2.3.2 Function.prototype.bind (thisArg, ...args )
        3. 20.2.3.3 Function.prototype.call (thisArg, ...args )
        4. 20.2.3.4 Function.prototype.constructor
        5. 20.2.3.5 Function.prototype.toString ( )
        6. 20.2.3.6 Function.prototype [ %Symbol.hasInstance% ] (V )
      4. +20.2.4 Function Instances
        1. 20.2.4.1 length
        2. 20.2.4.2 name
        3. 20.2.4.3 prototype
      5. 20.2.5 HostHasSourceTextAvailable (func )
    3. +20.3 Boolean Objects
      1. +20.3.1 The Boolean Constructor
        1. 20.3.1.1 Boolean (value )
      2. +20.3.2 Properties of the Boolean Constructor
        1. 20.3.2.1 Boolean.prototype
      3. +20.3.3 Properties of the Boolean Prototype Object
        1. 20.3.3.1 Boolean.prototype.constructor
        2. 20.3.3.2 Boolean.prototype.toString ( )
        3. +20.3.3.3 Boolean.prototype.valueOf ( )
          1. 20.3.3.3.1 ThisBooleanValue (value )
      4. 20.3.4 Properties of Boolean Instances
    4. +20.4 Symbol Objects
      1. +20.4.1 The Symbol Constructor
        1. 20.4.1.1 Symbol ( [description ] )
      2. +20.4.2 Properties of the Symbol Constructor
        1. 20.4.2.1 Symbol.asyncIterator
        2. 20.4.2.2 Symbol.for (key )
        3. 20.4.2.3 Symbol.hasInstance
        4. 20.4.2.4 Symbol.isConcatSpreadable
        5. 20.4.2.5 Symbol.iterator
        6. 20.4.2.6 Symbol.keyFor (sym )
        7. 20.4.2.7 Symbol.match
        8. 20.4.2.8 Symbol.matchAll
        9. 20.4.2.9 Symbol.prototype
        10. 20.4.2.10 Symbol.replace
        11. 20.4.2.11 Symbol.search
        12. 20.4.2.12 Symbol.species
        13. 20.4.2.13 Symbol.split
        14. 20.4.2.14 Symbol.toPrimitive
        15. 20.4.2.15 Symbol.toStringTag
        16. 20.4.2.16 Symbol.unscopables
      3. +20.4.3 Properties of the Symbol Prototype Object
        1. 20.4.3.1 Symbol.prototype.constructor
        2. 20.4.3.2 get Symbol.prototype.description
        3. +20.4.3.3 Symbol.prototype.toString ( )
          1. 20.4.3.3.1 SymbolDescriptiveString (sym )
        4. +20.4.3.4 Symbol.prototype.valueOf ( )
          1. 20.4.3.4.1 ThisSymbolValue (value )
        5. 20.4.3.5 Symbol.prototype [ %Symbol.toPrimitive% ] (hint )
        6. 20.4.3.6 Symbol.prototype [ %Symbol.toStringTag% ]
      4. 20.4.4 Properties of Symbol Instances
      5. +20.4.5 Abstract Operations for Symbols
        1. 20.4.5.1 KeyForSymbol (sym )
    5. +20.5 Error Objects
      1. +20.5.1 The Error Constructor
        1. 20.5.1.1 Error (message [ ,options ] )
      2. +20.5.2 Properties of the Error Constructor
        1. 20.5.2.1 Error.isError (arg )
        2. 20.5.2.2 Error.prototype
      3. +20.5.3 Properties of the Error Prototype Object
        1. 20.5.3.1 Error.prototype.constructor
        2. 20.5.3.2 Error.prototype.message
        3. 20.5.3.3 Error.prototype.name
        4. 20.5.3.4 Error.prototype.toString ( )
      4. 20.5.4 Properties of Error Instances
      5. +20.5.5 Native Error Types Used in This Standard
        1. 20.5.5.1 EvalError
        2. 20.5.5.2 RangeError
        3. 20.5.5.3 ReferenceError
        4. 20.5.5.4 SyntaxError
        5. 20.5.5.5 TypeError
        6. 20.5.5.6 URIError
      6. +20.5.6NativeError Object Structure
        1. +20.5.6.1 TheNativeError Constructors
          1. 20.5.6.1.1NativeError (message [ ,options ] )
        2. +20.5.6.2 Properties of theNativeError Constructors
          1. 20.5.6.2.1NativeError.prototype
        3. +20.5.6.3 Properties of theNativeError Prototype Objects
          1. 20.5.6.3.1NativeError.prototype.constructor
          2. 20.5.6.3.2NativeError.prototype.message
          3. 20.5.6.3.3NativeError.prototype.name
        4. 20.5.6.4 Properties ofNativeError Instances
      7. +20.5.7 AggregateError Objects
        1. +20.5.7.1 The AggregateError Constructor
          1. 20.5.7.1.1 AggregateError (errors,message [ ,options ] )
        2. +20.5.7.2 Properties of the AggregateError Constructor
          1. 20.5.7.2.1 AggregateError.prototype
        3. +20.5.7.3 Properties of the AggregateError Prototype Object
          1. 20.5.7.3.1 AggregateError.prototype.constructor
          2. 20.5.7.3.2 AggregateError.prototype.message
          3. 20.5.7.3.3 AggregateError.prototype.name
        4. 20.5.7.4 Properties of AggregateError Instances
      8. +20.5.8 Abstract Operations for Error Objects
        1. 20.5.8.1 InstallErrorCause (O,options )
  22. +21 Numbers and Dates
    1. +21.1 Number Objects
      1. +21.1.1 The Number Constructor
        1. 21.1.1.1 Number (value )
      2. +21.1.2 Properties of the Number Constructor
        1. 21.1.2.1 Number.EPSILON
        2. 21.1.2.2 Number.isFinite (number )
        3. 21.1.2.3 Number.isInteger (number )
        4. 21.1.2.4 Number.isNaN (number )
        5. 21.1.2.5 Number.isSafeInteger (number )
        6. 21.1.2.6 Number.MAX_SAFE_INTEGER
        7. 21.1.2.7 Number.MAX_VALUE
        8. 21.1.2.8 Number.MIN_SAFE_INTEGER
        9. 21.1.2.9 Number.MIN_VALUE
        10. 21.1.2.10 Number.NaN
        11. 21.1.2.11 Number.NEGATIVE_INFINITY
        12. 21.1.2.12 Number.parseFloat (string )
        13. 21.1.2.13 Number.parseInt (string,radix )
        14. 21.1.2.14 Number.POSITIVE_INFINITY
        15. 21.1.2.15 Number.prototype
      3. +21.1.3 Properties of the Number Prototype Object
        1. 21.1.3.1 Number.prototype.constructor
        2. 21.1.3.2 Number.prototype.toExponential (fractionDigits )
        3. 21.1.3.3 Number.prototype.toFixed (fractionDigits )
        4. 21.1.3.4 Number.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )
        5. 21.1.3.5 Number.prototype.toPrecision (precision )
        6. 21.1.3.6 Number.prototype.toString ( [radix ] )
        7. +21.1.3.7 Number.prototype.valueOf ( )
          1. 21.1.3.7.1 ThisNumberValue (value )
      4. 21.1.4 Properties of Number Instances
    2. +21.2 BigInt Objects
      1. +21.2.1 The BigInt Constructor
        1. +21.2.1.1 BigInt (value )
          1. 21.2.1.1.1 NumberToBigInt (number )
      2. +21.2.2 Properties of the BigInt Constructor
        1. 21.2.2.1 BigInt.asIntN (bits,bigint )
        2. 21.2.2.2 BigInt.asUintN (bits,bigint )
        3. 21.2.2.3 BigInt.prototype
      3. +21.2.3 Properties of the BigInt Prototype Object
        1. 21.2.3.1 BigInt.prototype.constructor
        2. 21.2.3.2 BigInt.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )
        3. 21.2.3.3 BigInt.prototype.toString ( [radix ] )
        4. +21.2.3.4 BigInt.prototype.valueOf ( )
          1. 21.2.3.4.1 ThisBigIntValue (value )
        5. 21.2.3.5 BigInt.prototype [ %Symbol.toStringTag% ]
      4. 21.2.4 Properties of BigInt Instances
    3. +21.3 The Math Object
      1. +21.3.1 Value Properties of the Math Object
        1. 21.3.1.1 Math.E
        2. 21.3.1.2 Math.LN10
        3. 21.3.1.3 Math.LN2
        4. 21.3.1.4 Math.LOG10E
        5. 21.3.1.5 Math.LOG2E
        6. 21.3.1.6 Math.PI
        7. 21.3.1.7 Math.SQRT1_2
        8. 21.3.1.8 Math.SQRT2
        9. 21.3.1.9 Math [ %Symbol.toStringTag% ]
      2. +21.3.2 Function Properties of the Math Object
        1. 21.3.2.1 Math.abs (x )
        2. 21.3.2.2 Math.acos (x )
        3. 21.3.2.3 Math.acosh (x )
        4. 21.3.2.4 Math.asin (x )
        5. 21.3.2.5 Math.asinh (x )
        6. 21.3.2.6 Math.atan (x )
        7. 21.3.2.7 Math.atanh (x )
        8. 21.3.2.8 Math.atan2 (y,x )
        9. 21.3.2.9 Math.cbrt (x )
        10. 21.3.2.10 Math.ceil (x )
        11. 21.3.2.11 Math.clz32 (x )
        12. 21.3.2.12 Math.cos (x )
        13. 21.3.2.13 Math.cosh (x )
        14. 21.3.2.14 Math.exp (x )
        15. 21.3.2.15 Math.expm1 (x )
        16. 21.3.2.16 Math.floor (x )
        17. 21.3.2.17 Math.fround (x )
        18. 21.3.2.18 Math.f16round (x )
        19. 21.3.2.19 Math.hypot ( ...args )
        20. 21.3.2.20 Math.imul (x,y )
        21. 21.3.2.21 Math.log (x )
        22. 21.3.2.22 Math.log1p (x )
        23. 21.3.2.23 Math.log10 (x )
        24. 21.3.2.24 Math.log2 (x )
        25. 21.3.2.25 Math.max ( ...args )
        26. 21.3.2.26 Math.min ( ...args )
        27. 21.3.2.27 Math.pow (base,exponent )
        28. 21.3.2.28 Math.random ( )
        29. 21.3.2.29 Math.round (x )
        30. 21.3.2.30 Math.sign (x )
        31. 21.3.2.31 Math.sin (x )
        32. 21.3.2.32 Math.sinh (x )
        33. 21.3.2.33 Math.sqrt (x )
        34. 21.3.2.34 Math.sumPrecise (items )
        35. 21.3.2.35 Math.tan (x )
        36. 21.3.2.36 Math.tanh (x )
        37. 21.3.2.37 Math.trunc (x )
    4. +21.4 Date Objects
      1. +21.4.1 Overview of Date Objects and Definitions of Abstract Operations
        1. 21.4.1.1 Time Values and Time Range
        2. 21.4.1.2 Time-related Constants
        3. 21.4.1.3 Day (t )
        4. 21.4.1.4 TimeWithinDay (t )
        5. 21.4.1.5 DaysInYear (y )
        6. 21.4.1.6 DayFromYear (y )
        7. 21.4.1.7 TimeFromYear (y )
        8. 21.4.1.8 YearFromTime (t )
        9. 21.4.1.9 DayWithinYear (t )
        10. 21.4.1.10 InLeapYear (t )
        11. 21.4.1.11 MonthFromTime (t )
        12. 21.4.1.12 DateFromTime (t )
        13. 21.4.1.13 WeekDay (t )
        14. 21.4.1.14 HourFromTime (t )
        15. 21.4.1.15 MinFromTime (t )
        16. 21.4.1.16 SecFromTime (t )
        17. 21.4.1.17 msFromTime (t )
        18. 21.4.1.18 GetUTCEpochNanoseconds (year,month,day,hour,minute,second,millisecond,microsecond,nanosecond )
        19. 21.4.1.19 Time Zone Identifiers
        20. 21.4.1.20 GetNamedTimeZoneEpochNanoseconds (timeZoneIdentifier,year,month,day,hour,minute,second,millisecond,microsecond,nanosecond )
        21. 21.4.1.21 GetNamedTimeZoneOffsetNanoseconds (timeZoneIdentifier,epochNanoseconds )
        22. 21.4.1.22 Time Zone Identifier Record
        23. 21.4.1.23 AvailableNamedTimeZoneIdentifiers ( )
        24. 21.4.1.24 SystemTimeZoneIdentifier ( )
        25. 21.4.1.25 LocalTime (t )
        26. 21.4.1.26 UTC (t )
        27. 21.4.1.27 MakeTime (hour,min,sec,ms )
        28. 21.4.1.28 MakeDay (year,month,date )
        29. 21.4.1.29 MakeDate (day,time )
        30. 21.4.1.30 MakeFullYear (year )
        31. 21.4.1.31 TimeClip (time )
        32. +21.4.1.32 Date Time String Format
          1. 21.4.1.32.1 Expanded Years
        33. +21.4.1.33 Time Zone Offset String Format
          1. 21.4.1.33.1 IsTimeZoneOffsetString (offsetString )
          2. 21.4.1.33.2 ParseTimeZoneOffsetString (offsetString )
      2. +21.4.2 The Date Constructor
        1. 21.4.2.1 Date ( ...values )
      3. +21.4.3 Properties of the Date Constructor
        1. 21.4.3.1 Date.now ( )
        2. 21.4.3.2 Date.parse (string )
        3. 21.4.3.3 Date.prototype
        4. 21.4.3.4 Date.UTC (year [ ,month [ ,date [ ,hours [ ,minutes [ ,seconds [ ,ms ] ] ] ] ] ] )
      4. +21.4.4 Properties of the Date Prototype Object
        1. 21.4.4.1 Date.prototype.constructor
        2. 21.4.4.2 Date.prototype.getDate ( )
        3. 21.4.4.3 Date.prototype.getDay ( )
        4. 21.4.4.4 Date.prototype.getFullYear ( )
        5. 21.4.4.5 Date.prototype.getHours ( )
        6. 21.4.4.6 Date.prototype.getMilliseconds ( )
        7. 21.4.4.7 Date.prototype.getMinutes ( )
        8. 21.4.4.8 Date.prototype.getMonth ( )
        9. 21.4.4.9 Date.prototype.getSeconds ( )
        10. 21.4.4.10 Date.prototype.getTime ( )
        11. 21.4.4.11 Date.prototype.getTimezoneOffset ( )
        12. 21.4.4.12 Date.prototype.getUTCDate ( )
        13. 21.4.4.13 Date.prototype.getUTCDay ( )
        14. 21.4.4.14 Date.prototype.getUTCFullYear ( )
        15. 21.4.4.15 Date.prototype.getUTCHours ( )
        16. 21.4.4.16 Date.prototype.getUTCMilliseconds ( )
        17. 21.4.4.17 Date.prototype.getUTCMinutes ( )
        18. 21.4.4.18 Date.prototype.getUTCMonth ( )
        19. 21.4.4.19 Date.prototype.getUTCSeconds ( )
        20. 21.4.4.20 Date.prototype.setDate (date )
        21. 21.4.4.21 Date.prototype.setFullYear (year [ ,month [ ,date ] ] )
        22. 21.4.4.22 Date.prototype.setHours (hour [ ,min [ ,sec [ ,ms ] ] ] )
        23. 21.4.4.23 Date.prototype.setMilliseconds (ms )
        24. 21.4.4.24 Date.prototype.setMinutes (min [ ,sec [ ,ms ] ] )
        25. 21.4.4.25 Date.prototype.setMonth (month [ ,date ] )
        26. 21.4.4.26 Date.prototype.setSeconds (sec [ ,ms ] )
        27. 21.4.4.27 Date.prototype.setTime (time )
        28. 21.4.4.28 Date.prototype.setUTCDate (date )
        29. 21.4.4.29 Date.prototype.setUTCFullYear (year [ ,month [ ,date ] ] )
        30. 21.4.4.30 Date.prototype.setUTCHours (hour [ ,min [ ,sec [ ,ms ] ] ] )
        31. 21.4.4.31 Date.prototype.setUTCMilliseconds (ms )
        32. 21.4.4.32 Date.prototype.setUTCMinutes (min [ ,sec [ ,ms ] ] )
        33. 21.4.4.33 Date.prototype.setUTCMonth (month [ ,date ] )
        34. 21.4.4.34 Date.prototype.setUTCSeconds (sec [ ,ms ] )
        35. 21.4.4.35 Date.prototype.toDateString ( )
        36. 21.4.4.36 Date.prototype.toISOString ( )
        37. 21.4.4.37 Date.prototype.toJSON (key )
        38. 21.4.4.38 Date.prototype.toLocaleDateString ( [reserved1 [ ,reserved2 ] ] )
        39. 21.4.4.39 Date.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )
        40. 21.4.4.40 Date.prototype.toLocaleTimeString ( [reserved1 [ ,reserved2 ] ] )
        41. +21.4.4.41 Date.prototype.toString ( )
          1. 21.4.4.41.1 TimeString (tv )
          2. 21.4.4.41.2 DateString (tv )
          3. 21.4.4.41.3 TimeZoneString (tv )
          4. 21.4.4.41.4 ToDateString (tv )
        42. 21.4.4.42 Date.prototype.toTimeString ( )
        43. 21.4.4.43 Date.prototype.toUTCString ( )
        44. 21.4.4.44 Date.prototype.valueOf ( )
        45. 21.4.4.45 Date.prototype [ %Symbol.toPrimitive% ] (hint )
      5. 21.4.5 Properties of Date Instances
  23. +22 Text Processing
    1. +22.1 String Objects
      1. +22.1.1 The String Constructor
        1. 22.1.1.1 String (value )
      2. +22.1.2 Properties of the String Constructor
        1. 22.1.2.1 String.fromCharCode ( ...codeUnits )
        2. 22.1.2.2 String.fromCodePoint ( ...codePoints )
        3. 22.1.2.3 String.prototype
        4. 22.1.2.4 String.raw (template, ...substitutions )
      3. +22.1.3 Properties of the String Prototype Object
        1. 22.1.3.1 String.prototype.at (index )
        2. 22.1.3.2 String.prototype.charAt (pos )
        3. 22.1.3.3 String.prototype.charCodeAt (pos )
        4. 22.1.3.4 String.prototype.codePointAt (pos )
        5. 22.1.3.5 String.prototype.concat ( ...args )
        6. 22.1.3.6 String.prototype.constructor
        7. 22.1.3.7 String.prototype.endsWith (searchString [ ,endPosition ] )
        8. 22.1.3.8 String.prototype.includes (searchString [ ,position ] )
        9. 22.1.3.9 String.prototype.indexOf (searchString [ ,position ] )
        10. 22.1.3.10 String.prototype.isWellFormed ( )
        11. 22.1.3.11 String.prototype.lastIndexOf (searchString [ ,position ] )
        12. 22.1.3.12 String.prototype.localeCompare (that [ ,reserved1 [ ,reserved2 ] ] )
        13. 22.1.3.13 String.prototype.match (regexp )
        14. 22.1.3.14 String.prototype.matchAll (regexp )
        15. 22.1.3.15 String.prototype.normalize ( [form ] )
        16. 22.1.3.16 String.prototype.padEnd (maxLength [ ,fillString ] )
        17. +22.1.3.17 String.prototype.padStart (maxLength [ ,fillString ] )
          1. 22.1.3.17.1 StringPaddingBuiltinsImpl (O,maxLength,fillString,placement )
          2. 22.1.3.17.2 StringPad (S,maxLength,fillString,placement )
          3. 22.1.3.17.3 ToZeroPaddedDecimalString (n,minLength )
        18. 22.1.3.18 String.prototype.repeat (count )
        19. +22.1.3.19 String.prototype.replace (searchValue,replaceValue )
          1. 22.1.3.19.1 GetSubstitution (matched,str,position,captures,namedCaptures,replacementTemplate )
        20. 22.1.3.20 String.prototype.replaceAll (searchValue,replaceValue )
        21. 22.1.3.21 String.prototype.search (regexp )
        22. 22.1.3.22 String.prototype.slice (start,end )
        23. 22.1.3.23 String.prototype.split (separator,limit )
        24. 22.1.3.24 String.prototype.startsWith (searchString [ ,position ] )
        25. 22.1.3.25 String.prototype.substring (start,end )
        26. 22.1.3.26 String.prototype.toLocaleLowerCase ( [reserved1 [ ,reserved2 ] ] )
        27. 22.1.3.27 String.prototype.toLocaleUpperCase ( [reserved1 [ ,reserved2 ] ] )
        28. 22.1.3.28 String.prototype.toLowerCase ( )
        29. 22.1.3.29 String.prototype.toString ( )
        30. 22.1.3.30 String.prototype.toUpperCase ( )
        31. 22.1.3.31 String.prototype.toWellFormed ( )
        32. +22.1.3.32 String.prototype.trim ( )
          1. 22.1.3.32.1 TrimString (string,where )
        33. 22.1.3.33 String.prototype.trimEnd ( )
        34. 22.1.3.34 String.prototype.trimStart ( )
        35. +22.1.3.35 String.prototype.valueOf ( )
          1. 22.1.3.35.1 ThisStringValue (value )
        36. 22.1.3.36 String.prototype [ %Symbol.iterator% ] ( )
      4. +22.1.4 Properties of String Instances
        1. 22.1.4.1 length
      5. +22.1.5 String Iterator Objects
        1. +22.1.5.1 The %StringIteratorPrototype% Object
          1. 22.1.5.1.1 %StringIteratorPrototype%.next ( )
          2. 22.1.5.1.2 %StringIteratorPrototype% [ %Symbol.toStringTag% ]
    2. +22.2 RegExp (Regular Expression) Objects
      1. +22.2.1 Patterns
        1. 22.2.1.1 SS: Early Errors
        2. 22.2.1.2 SS: CountLeftCapturingParensWithin (node )
        3. 22.2.1.3 SS: CountLeftCapturingParensBefore (node )
        4. 22.2.1.4 SS: MightBothParticipate (x,y )
        5. 22.2.1.5 SS: CapturingGroupNumber
        6. 22.2.1.6 SS: IsCharacterClass
        7. 22.2.1.7 SS: CharacterValue
        8. 22.2.1.8 SS: MayContainStrings
        9. 22.2.1.9 SS: GroupSpecifiersThatMatch (thisGroupName )
        10. 22.2.1.10 SS: CapturingGroupName
        11. 22.2.1.11 SS: RegExpIdentifierCodePoints
        12. 22.2.1.12 SS: RegExpIdentifierCodePoint
      2. +22.2.2 Pattern Semantics
        1. +22.2.2.1 Notation
          1. 22.2.2.1.1 RegExp Records
        2. 22.2.2.2 RS: CompilePattern
        3. +22.2.2.3 RS: CompileSubpattern
          1. 22.2.2.3.1 RepeatMatcher (m,min,max,greedy,x,c,parenIndex,parenCount )
          2. 22.2.2.3.2 EmptyMatcher ( )
          3. 22.2.2.3.3 MatchTwoAlternatives (m1,m2 )
          4. 22.2.2.3.4 MatchSequence (m1,m2,direction )
        4. +22.2.2.4 RS: CompileAssertion
          1. 22.2.2.4.1 IsWordChar (rer,Input,e )
        5. 22.2.2.5 RS: CompileQuantifier
        6. 22.2.2.6 RS: CompileQuantifierPrefix
        7. +22.2.2.7 RS: CompileAtom
          1. 22.2.2.7.1 CharacterSetMatcher (rer,A,invert,direction )
          2. 22.2.2.7.2 BackreferenceMatcher (rer,ns,direction )
          3. 22.2.2.7.3 Canonicalize (rer,ch )
          4. 22.2.2.7.4 UpdateModifiers (rer,add,remove )
        8. 22.2.2.8 RS: CompileCharacterClass
        9. +22.2.2.9 RS: CompileToCharSet
          1. 22.2.2.9.1 CharacterRange (A,B )
          2. 22.2.2.9.2 HasEitherUnicodeFlag (rer )
          3. 22.2.2.9.3 WordCharacters (rer )
          4. 22.2.2.9.4 AllCharacters (rer )
          5. 22.2.2.9.5 MaybeSimpleCaseFolding (rer,A )
          6. 22.2.2.9.6 CharacterComplement (rer,S )
          7. 22.2.2.9.7 UnicodeMatchProperty (rer,p )
          8. 22.2.2.9.8 UnicodeMatchPropertyValue (p,v )
        10. 22.2.2.10 RS: CompileClassSetString
      3. +22.2.3 Abstract Operations for RegExp Creation
        1. 22.2.3.1 RegExpCreate (P,F )
        2. 22.2.3.2 RegExpAlloc (newTarget )
        3. 22.2.3.3 RegExpInitialize (obj,pattern,flags )
        4. 22.2.3.4 SS: ParsePattern (patternText,u,v )
      4. +22.2.4 The RegExp Constructor
        1. 22.2.4.1 RegExp (pattern,flags )
      5. +22.2.5 Properties of the RegExp Constructor
        1. +22.2.5.1 RegExp.escape (S )
          1. 22.2.5.1.1 EncodeForRegExpEscape (cp )
        2. 22.2.5.2 RegExp.prototype
        3. 22.2.5.3 get RegExp [ %Symbol.species% ]
      6. +22.2.6 Properties of the RegExp Prototype Object
        1. 22.2.6.1 RegExp.prototype.constructor
        2. 22.2.6.2 RegExp.prototype.exec (string )
        3. 22.2.6.3 get RegExp.prototype.dotAll
        4. +22.2.6.4 get RegExp.prototype.flags
          1. 22.2.6.4.1 RegExpHasFlag (R,codeUnit )
        5. 22.2.6.5 get RegExp.prototype.global
        6. 22.2.6.6 get RegExp.prototype.hasIndices
        7. 22.2.6.7 get RegExp.prototype.ignoreCase
        8. 22.2.6.8 RegExp.prototype [ %Symbol.match% ] (string )
        9. 22.2.6.9 RegExp.prototype [ %Symbol.matchAll% ] (string )
        10. 22.2.6.10 get RegExp.prototype.multiline
        11. 22.2.6.11 RegExp.prototype [ %Symbol.replace% ] (string,replaceValue )
        12. 22.2.6.12 RegExp.prototype [ %Symbol.search% ] (string )
        13. +22.2.6.13 get RegExp.prototype.source
          1. 22.2.6.13.1 EscapeRegExpPattern (P,F )
        14. 22.2.6.14 RegExp.prototype [ %Symbol.split% ] (string,limit )
        15. 22.2.6.15 get RegExp.prototype.sticky
        16. 22.2.6.16 RegExp.prototype.test (S )
        17. 22.2.6.17 RegExp.prototype.toString ( )
        18. 22.2.6.18 get RegExp.prototype.unicode
        19. 22.2.6.19 get RegExp.prototype.unicodeSets
      7. +22.2.7 Abstract Operations for RegExp Matching
        1. 22.2.7.1 RegExpExec (R,S )
        2. 22.2.7.2 RegExpBuiltinExec (R,S )
        3. 22.2.7.3 AdvanceStringIndex (S,index,unicode )
        4. 22.2.7.4 GetStringIndex (S,codePointIndex )
        5. 22.2.7.5 Match Records
        6. 22.2.7.6 GetMatchString (S,match )
        7. 22.2.7.7 GetMatchIndexPair (S,match )
        8. 22.2.7.8 MakeMatchIndicesIndexPairArray (S,indices,groupNames,hasGroups )
      8. +22.2.8 Properties of RegExp Instances
        1. 22.2.8.1 lastIndex
      9. +22.2.9 RegExp String Iterator Objects
        1. 22.2.9.1 CreateRegExpStringIterator (R,S,global,fullUnicode )
        2. +22.2.9.2 The %RegExpStringIteratorPrototype% Object
          1. 22.2.9.2.1 %RegExpStringIteratorPrototype%.next ( )
          2. 22.2.9.2.2 %RegExpStringIteratorPrototype% [ %Symbol.toStringTag% ]
        3. 22.2.9.3 Properties of RegExp String Iterator Instances
  24. +23 Indexed Collections
    1. +23.1 Array Objects
      1. +23.1.1 The Array Constructor
        1. 23.1.1.1 Array ( ...values )
      2. +23.1.2 Properties of the Array Constructor
        1. 23.1.2.1 Array.from (items [ ,mapper [ ,thisArg ] ] )
        2. 23.1.2.2 Array.isArray (arg )
        3. 23.1.2.3 Array.of ( ...items )
        4. 23.1.2.4 Array.prototype
        5. 23.1.2.5 get Array [ %Symbol.species% ]
      3. +23.1.3 Properties of the Array Prototype Object
        1. 23.1.3.1 Array.prototype.at (index )
        2. +23.1.3.2 Array.prototype.concat ( ...items )
          1. 23.1.3.2.1 IsConcatSpreadable (O )
        3. 23.1.3.3 Array.prototype.constructor
        4. 23.1.3.4 Array.prototype.copyWithin (target,start [ ,end ] )
        5. 23.1.3.5 Array.prototype.entries ( )
        6. 23.1.3.6 Array.prototype.every (callback [ ,thisArg ] )
        7. 23.1.3.7 Array.prototype.fill (value [ ,start [ ,end ] ] )
        8. 23.1.3.8 Array.prototype.filter (callback [ ,thisArg ] )
        9. 23.1.3.9 Array.prototype.find (predicate [ ,thisArg ] )
        10. 23.1.3.10 Array.prototype.findIndex (predicate [ ,thisArg ] )
        11. 23.1.3.11 Array.prototype.findLast (predicate [ ,thisArg ] )
        12. +23.1.3.12 Array.prototype.findLastIndex (predicate [ ,thisArg ] )
          1. 23.1.3.12.1 FindViaPredicate (O,len,direction,predicate,thisArg )
        13. +23.1.3.13 Array.prototype.flat ( [depth ] )
          1. 23.1.3.13.1 FlattenIntoArray (target,source,sourceLen,start,depth [ ,mapperFunction [ ,thisArg ] ] )
        14. 23.1.3.14 Array.prototype.flatMap (mapperFunction [ ,thisArg ] )
        15. 23.1.3.15 Array.prototype.forEach (callback [ ,thisArg ] )
        16. 23.1.3.16 Array.prototype.includes (searchElement [ ,fromIndex ] )
        17. 23.1.3.17 Array.prototype.indexOf (searchElement [ ,fromIndex ] )
        18. 23.1.3.18 Array.prototype.join (separator )
        19. 23.1.3.19 Array.prototype.keys ( )
        20. 23.1.3.20 Array.prototype.lastIndexOf (searchElement [ ,fromIndex ] )
        21. 23.1.3.21 Array.prototype.map (callback [ ,thisArg ] )
        22. 23.1.3.22 Array.prototype.pop ( )
        23. 23.1.3.23 Array.prototype.push ( ...items )
        24. 23.1.3.24 Array.prototype.reduce (callback [ ,initialValue ] )
        25. 23.1.3.25 Array.prototype.reduceRight (callback [ ,initialValue ] )
        26. 23.1.3.26 Array.prototype.reverse ( )
        27. 23.1.3.27 Array.prototype.shift ( )
        28. 23.1.3.28 Array.prototype.slice (start,end )
        29. 23.1.3.29 Array.prototype.some (callback [ ,thisArg ] )
        30. +23.1.3.30 Array.prototype.sort (comparator )
          1. 23.1.3.30.1 SortIndexedProperties (obj,len,SortCompare,holes )
          2. 23.1.3.30.2 CompareArrayElements (x,y,comparator )
        31. 23.1.3.31 Array.prototype.splice (start,deleteCount, ...items )
        32. 23.1.3.32 Array.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )
        33. 23.1.3.33 Array.prototype.toReversed ( )
        34. 23.1.3.34 Array.prototype.toSorted (comparator )
        35. 23.1.3.35 Array.prototype.toSpliced (start,skipCount, ...items )
        36. 23.1.3.36 Array.prototype.toString ( )
        37. 23.1.3.37 Array.prototype.unshift ( ...items )
        38. 23.1.3.38 Array.prototype.values ( )
        39. 23.1.3.39 Array.prototype.with (index,value )
        40. 23.1.3.40 Array.prototype [ %Symbol.iterator% ] ( )
        41. 23.1.3.41 Array.prototype [ %Symbol.unscopables% ]
      4. +23.1.4 Properties of Array Instances
        1. 23.1.4.1 length
      5. +23.1.5 Array Iterator Objects
        1. 23.1.5.1 CreateArrayIterator (array,kind )
        2. +23.1.5.2 The %ArrayIteratorPrototype% Object
          1. 23.1.5.2.1 %ArrayIteratorPrototype%.next ( )
          2. 23.1.5.2.2 %ArrayIteratorPrototype% [ %Symbol.toStringTag% ]
        3. 23.1.5.3 Properties of Array Iterator Instances
    2. +23.2 TypedArray Objects
      1. +23.2.1 The %TypedArray% Intrinsic Object
        1. 23.2.1.1 %TypedArray% ( )
      2. +23.2.2 Properties of the %TypedArray% Intrinsic Object
        1. 23.2.2.1 %TypedArray%.from (source [ ,mapper [ ,thisArg ] ] )
        2. 23.2.2.2 %TypedArray%.of ( ...items )
        3. 23.2.2.3 %TypedArray%.prototype
        4. 23.2.2.4 get %TypedArray% [ %Symbol.species% ]
      3. +23.2.3 Properties of the %TypedArray% Prototype Object
        1. 23.2.3.1 %TypedArray%.prototype.at (index )
        2. 23.2.3.2 get %TypedArray%.prototype.buffer
        3. 23.2.3.3 get %TypedArray%.prototype.byteLength
        4. 23.2.3.4 get %TypedArray%.prototype.byteOffset
        5. 23.2.3.5 %TypedArray%.prototype.constructor
        6. 23.2.3.6 %TypedArray%.prototype.copyWithin (target,start [ ,end ] )
        7. 23.2.3.7 %TypedArray%.prototype.entries ( )
        8. 23.2.3.8 %TypedArray%.prototype.every (callback [ ,thisArg ] )
        9. 23.2.3.9 %TypedArray%.prototype.fill (value [ ,start [ ,end ] ] )
        10. 23.2.3.10 %TypedArray%.prototype.filter (callback [ ,thisArg ] )
        11. 23.2.3.11 %TypedArray%.prototype.find (predicate [ ,thisArg ] )
        12. 23.2.3.12 %TypedArray%.prototype.findIndex (predicate [ ,thisArg ] )
        13. 23.2.3.13 %TypedArray%.prototype.findLast (predicate [ ,thisArg ] )
        14. 23.2.3.14 %TypedArray%.prototype.findLastIndex (predicate [ ,thisArg ] )
        15. 23.2.3.15 %TypedArray%.prototype.forEach (callback [ ,thisArg ] )
        16. 23.2.3.16 %TypedArray%.prototype.includes (searchElement [ ,fromIndex ] )
        17. 23.2.3.17 %TypedArray%.prototype.indexOf (searchElement [ ,fromIndex ] )
        18. 23.2.3.18 %TypedArray%.prototype.join (separator )
        19. 23.2.3.19 %TypedArray%.prototype.keys ( )
        20. 23.2.3.20 %TypedArray%.prototype.lastIndexOf (searchElement [ ,fromIndex ] )
        21. 23.2.3.21 get %TypedArray%.prototype.length
        22. 23.2.3.22 %TypedArray%.prototype.map (callback [ ,thisArg ] )
        23. 23.2.3.23 %TypedArray%.prototype.reduce (callback [ ,initialValue ] )
        24. 23.2.3.24 %TypedArray%.prototype.reduceRight (callback [ ,initialValue ] )
        25. 23.2.3.25 %TypedArray%.prototype.reverse ( )
        26. +23.2.3.26 %TypedArray%.prototype.set (source [ ,offset ] )
          1. 23.2.3.26.1 SetTypedArrayFromArrayLike (target,targetOffset,source )
          2. 23.2.3.26.2 SetTypedArrayFromTypedArray (target,targetOffset,source )
        27. 23.2.3.27 %TypedArray%.prototype.slice (start,end )
        28. 23.2.3.28 %TypedArray%.prototype.some (callback [ ,thisArg ] )
        29. 23.2.3.29 %TypedArray%.prototype.sort (comparator )
        30. 23.2.3.30 %TypedArray%.prototype.subarray (start,end )
        31. 23.2.3.31 %TypedArray%.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )
        32. 23.2.3.32 %TypedArray%.prototype.toReversed ( )
        33. 23.2.3.33 %TypedArray%.prototype.toSorted (comparator )
        34. 23.2.3.34 %TypedArray%.prototype.toString ( )
        35. 23.2.3.35 %TypedArray%.prototype.values ( )
        36. 23.2.3.36 %TypedArray%.prototype.with (index,value )
        37. 23.2.3.37 %TypedArray%.prototype [ %Symbol.iterator% ] ( )
        38. 23.2.3.38 get %TypedArray%.prototype [ %Symbol.toStringTag% ]
      4. +23.2.4 Abstract Operations for TypedArray Objects
        1. 23.2.4.1 TypedArrayCreateFromConstructor (constructor,argumentList )
        2. 23.2.4.2 TypedArrayCreateSameType (exemplar,length )
        3. 23.2.4.3 TypedArraySpeciesCreate (exemplar,argumentList )
        4. 23.2.4.4 ValidateTypedArray (O,order )
        5. 23.2.4.5 TypedArrayElementSize (O )
        6. 23.2.4.6 TypedArrayElementType (O )
        7. 23.2.4.7 CompareTypedArrayElements (x,y,comparator )
      5. +23.2.5 TheTypedArray Constructors
        1. +23.2.5.1TypedArray ( ...args )
          1. 23.2.5.1.1 AllocateTypedArray (constructorName,newTarget,defaultProto [ ,length ] )
          2. 23.2.5.1.2 InitializeTypedArrayFromTypedArray (O,srcArray )
          3. 23.2.5.1.3 InitializeTypedArrayFromArrayBuffer (O,buffer,byteOffset,length )
          4. 23.2.5.1.4 InitializeTypedArrayFromList (O,values )
          5. 23.2.5.1.5 InitializeTypedArrayFromArrayLike (O,arrayLike )
          6. 23.2.5.1.6 AllocateTypedArrayBuffer (O,length )
      6. +23.2.6 Properties of theTypedArray Constructors
        1. 23.2.6.1TypedArray.BYTES_PER_ELEMENT
        2. 23.2.6.2TypedArray.prototype
      7. +23.2.7 Properties of theTypedArray Prototype Objects
        1. 23.2.7.1TypedArray.prototype.BYTES_PER_ELEMENT
        2. 23.2.7.2TypedArray.prototype.constructor
      8. 23.2.8 Properties ofTypedArray Instances
    3. +23.3 Uint8Array Objects
      1. +23.3.1 Additional Properties of the Uint8Array Constructor
        1. 23.3.1.1 Uint8Array.fromBase64 (string [ ,options ] )
        2. 23.3.1.2 Uint8Array.fromHex (string )
      2. +23.3.2 Additional Properties of the Uint8Array Prototype Object
        1. 23.3.2.1 Uint8Array.prototype.setFromBase64 (string [ ,options ] )
        2. 23.3.2.2 Uint8Array.prototype.setFromHex (string )
        3. 23.3.2.3 Uint8Array.prototype.toBase64 ( [options ] )
        4. 23.3.2.4 Uint8Array.prototype.toHex ( )
      3. +23.3.3 Abstract Operations for Uint8Array Objects
        1. 23.3.3.1 ValidateUint8Array (ta )
        2. 23.3.3.2 GetUint8ArrayBytes (ta )
        3. 23.3.3.3 SetUint8ArrayBytes (into,bytes )
        4. 23.3.3.4 SkipAsciiWhitespace (string,index )
        5. 23.3.3.5 DecodeFinalBase64Chunk (chunk,throwOnExtraBits )
        6. 23.3.3.6 DecodeFullLengthBase64Chunk (chunk )
        7. 23.3.3.7 FromBase64 (string,alphabet,lastChunkHandling [ ,maxLength ] )
        8. 23.3.3.8 FromHex (string [ ,maxLength ] )
  25. +24 Keyed Collections
    1. +24.1 Map Objects
      1. +24.1.1 The Map Constructor
        1. 24.1.1.1 Map ( [iterable ] )
        2. 24.1.1.2 AddEntriesFromIterable (target,iterable,adder )
      2. +24.1.2 Properties of the Map Constructor
        1. 24.1.2.1 Map.groupBy (items,callback )
        2. 24.1.2.2 Map.prototype
        3. 24.1.2.3 get Map [ %Symbol.species% ]
      3. +24.1.3 Properties of the Map Prototype Object
        1. 24.1.3.1 Map.prototype.clear ( )
        2. 24.1.3.2 Map.prototype.constructor
        3. 24.1.3.3 Map.prototype.delete (key )
        4. 24.1.3.4 Map.prototype.entries ( )
        5. 24.1.3.5 Map.prototype.forEach (callback [ ,thisArg ] )
        6. 24.1.3.6 Map.prototype.get (key )
        7. 24.1.3.7 Map.prototype.has (key )
        8. 24.1.3.8 Map.prototype.keys ( )
        9. 24.1.3.9 Map.prototype.set (key,value )
        10. 24.1.3.10 get Map.prototype.size
        11. 24.1.3.11 Map.prototype.values ( )
        12. 24.1.3.12 Map.prototype [ %Symbol.iterator% ] ( )
        13. 24.1.3.13 Map.prototype [ %Symbol.toStringTag% ]
      4. 24.1.4 Properties of Map Instances
      5. +24.1.5 Map Iterator Objects
        1. 24.1.5.1 CreateMapIterator (map,kind )
        2. +24.1.5.2 The %MapIteratorPrototype% Object
          1. 24.1.5.2.1 %MapIteratorPrototype%.next ( )
          2. 24.1.5.2.2 %MapIteratorPrototype% [ %Symbol.toStringTag% ]
    2. +24.2 Set Objects
      1. +24.2.1 Abstract Operations For Set Objects
        1. 24.2.1.1 Set Records
        2. 24.2.1.2 GetSetRecord (obj )
        3. 24.2.1.3 SetDataHas (setData,value )
        4. 24.2.1.4 SetDataIndex (setData,value )
        5. 24.2.1.5 SetDataSize (setData )
      2. +24.2.2 The Set Constructor
        1. 24.2.2.1 Set ( [iterable ] )
      3. +24.2.3 Properties of the Set Constructor
        1. 24.2.3.1 Set.prototype
        2. 24.2.3.2 get Set [ %Symbol.species% ]
      4. +24.2.4 Properties of the Set Prototype Object
        1. 24.2.4.1 Set.prototype.add (value )
        2. 24.2.4.2 Set.prototype.clear ( )
        3. 24.2.4.3 Set.prototype.constructor
        4. 24.2.4.4 Set.prototype.delete (value )
        5. 24.2.4.5 Set.prototype.difference (other )
        6. 24.2.4.6 Set.prototype.entries ( )
        7. 24.2.4.7 Set.prototype.forEach (callback [ ,thisArg ] )
        8. 24.2.4.8 Set.prototype.has (value )
        9. 24.2.4.9 Set.prototype.intersection (other )
        10. 24.2.4.10 Set.prototype.isDisjointFrom (other )
        11. 24.2.4.11 Set.prototype.isSubsetOf (other )
        12. 24.2.4.12 Set.prototype.isSupersetOf (other )
        13. 24.2.4.13 Set.prototype.keys ( )
        14. 24.2.4.14 get Set.prototype.size
        15. 24.2.4.15 Set.prototype.symmetricDifference (other )
        16. 24.2.4.16 Set.prototype.union (other )
        17. 24.2.4.17 Set.prototype.values ( )
        18. 24.2.4.18 Set.prototype [ %Symbol.iterator% ] ( )
        19. 24.2.4.19 Set.prototype [ %Symbol.toStringTag% ]
      5. 24.2.5 Properties of Set Instances
      6. +24.2.6 Set Iterator Objects
        1. 24.2.6.1 CreateSetIterator (set,kind )
        2. +24.2.6.2 The %SetIteratorPrototype% Object
          1. 24.2.6.2.1 %SetIteratorPrototype%.next ( )
          2. 24.2.6.2.2 %SetIteratorPrototype% [ %Symbol.toStringTag% ]
    3. +24.3 WeakMap Objects
      1. +24.3.1 The WeakMap Constructor
        1. 24.3.1.1 WeakMap ( [iterable ] )
      2. +24.3.2 Properties of the WeakMap Constructor
        1. 24.3.2.1 WeakMap.prototype
      3. +24.3.3 Properties of the WeakMap Prototype Object
        1. 24.3.3.1 WeakMap.prototype.constructor
        2. 24.3.3.2 WeakMap.prototype.delete (key )
        3. 24.3.3.3 WeakMap.prototype.get (key )
        4. 24.3.3.4 WeakMap.prototype.has (key )
        5. 24.3.3.5 WeakMap.prototype.set (key,value )
        6. 24.3.3.6 WeakMap.prototype [ %Symbol.toStringTag% ]
      4. 24.3.4 Properties of WeakMap Instances
    4. +24.4 WeakSet Objects
      1. +24.4.1 The WeakSet Constructor
        1. 24.4.1.1 WeakSet ( [iterable ] )
      2. +24.4.2 Properties of the WeakSet Constructor
        1. 24.4.2.1 WeakSet.prototype
      3. +24.4.3 Properties of the WeakSet Prototype Object
        1. 24.4.3.1 WeakSet.prototype.add (value )
        2. 24.4.3.2 WeakSet.prototype.constructor
        3. 24.4.3.3 WeakSet.prototype.delete (value )
        4. 24.4.3.4 WeakSet.prototype.has (value )
        5. 24.4.3.5 WeakSet.prototype [ %Symbol.toStringTag% ]
      4. 24.4.4 Properties of WeakSet Instances
    5. +24.5 Abstract Operations for Keyed Collections
      1. 24.5.1 CanonicalizeKeyedCollectionKey (key )
  26. +25 Structured Data
    1. +25.1 ArrayBuffer Objects
      1. 25.1.1 Notation
      2. 25.1.2 Fixed-length and Resizable ArrayBuffer Objects
      3. +25.1.3 Abstract Operations For ArrayBuffer Objects
        1. 25.1.3.1 AllocateArrayBuffer (constructor,byteLength [ ,maxByteLength ] )
        2. 25.1.3.2 ArrayBufferByteLength (arrayBuffer,order )
        3. 25.1.3.3 ArrayBufferCopyAndDetach (arrayBuffer,newLength,preserveResizability )
        4. 25.1.3.4 IsDetachedBuffer (arrayBuffer )
        5. 25.1.3.5 DetachArrayBuffer (arrayBuffer [ ,key ] )
        6. 25.1.3.6 CloneArrayBuffer (srcBuffer,srcByteOffset,srcLength )
        7. 25.1.3.7 GetArrayBufferMaxByteLengthOption (options )
        8. 25.1.3.8 HostResizeArrayBuffer (buffer,newByteLength )
        9. 25.1.3.9 IsFixedLengthArrayBuffer (arrayBuffer )
        10. 25.1.3.10 IsUnsignedElementType (type )
        11. 25.1.3.11 IsUnclampedIntegerElementType (type )
        12. 25.1.3.12 IsBigIntElementType (type )
        13. 25.1.3.13 IsNoTearConfiguration (type,order )
        14. 25.1.3.14 RawBytesToNumeric (type,rawBytes,isLittleEndian )
        15. 25.1.3.15 GetRawBytesFromSharedBlock (block,byteIndex,type,isTypedArray,order )
        16. 25.1.3.16 GetValueFromBuffer (arrayBuffer,byteIndex,type,isTypedArray,order [ ,isLittleEndian ] )
        17. 25.1.3.17 NumericToRawBytes (type,value,isLittleEndian )
        18. 25.1.3.18 SetValueInBuffer (arrayBuffer,byteIndex,type,value,isTypedArray,order [ ,isLittleEndian ] )
        19. 25.1.3.19 GetModifySetValueInBuffer (arrayBuffer,byteIndex,type,value,op )
      4. +25.1.4 The ArrayBuffer Constructor
        1. 25.1.4.1 ArrayBuffer (length [ ,options ] )
      5. +25.1.5 Properties of the ArrayBuffer Constructor
        1. 25.1.5.1 ArrayBuffer.isView (arg )
        2. 25.1.5.2 ArrayBuffer.prototype
        3. 25.1.5.3 get ArrayBuffer [ %Symbol.species% ]
      6. +25.1.6 Properties of the ArrayBuffer Prototype Object
        1. 25.1.6.1 get ArrayBuffer.prototype.byteLength
        2. 25.1.6.2 ArrayBuffer.prototype.constructor
        3. 25.1.6.3 get ArrayBuffer.prototype.detached
        4. 25.1.6.4 get ArrayBuffer.prototype.maxByteLength
        5. 25.1.6.5 get ArrayBuffer.prototype.resizable
        6. 25.1.6.6 ArrayBuffer.prototype.resize (newLength )
        7. 25.1.6.7 ArrayBuffer.prototype.slice (start,end )
        8. 25.1.6.8 ArrayBuffer.prototype.transfer ( [newLength ] )
        9. 25.1.6.9 ArrayBuffer.prototype.transferToFixedLength ( [newLength ] )
        10. 25.1.6.10 ArrayBuffer.prototype [ %Symbol.toStringTag% ]
      7. 25.1.7 Properties of ArrayBuffer Instances
      8. 25.1.8 Resizable ArrayBuffer Guidelines
    2. +25.2 SharedArrayBuffer Objects
      1. 25.2.1 Fixed-length and Growable SharedArrayBuffer Objects
      2. +25.2.2 Abstract Operations for SharedArrayBuffer Objects
        1. 25.2.2.1 AllocateSharedArrayBuffer (constructor,byteLength [ ,maxByteLength ] )
        2. 25.2.2.2 IsSharedArrayBuffer (obj )
        3. 25.2.2.3 HostGrowSharedArrayBuffer (buffer,newByteLength )
      3. +25.2.3 The SharedArrayBuffer Constructor
        1. 25.2.3.1 SharedArrayBuffer (length [ ,options ] )
      4. +25.2.4 Properties of the SharedArrayBuffer Constructor
        1. 25.2.4.1 SharedArrayBuffer.prototype
        2. 25.2.4.2 get SharedArrayBuffer [ %Symbol.species% ]
      5. +25.2.5 Properties of the SharedArrayBuffer Prototype Object
        1. 25.2.5.1 get SharedArrayBuffer.prototype.byteLength
        2. 25.2.5.2 SharedArrayBuffer.prototype.constructor
        3. 25.2.5.3 SharedArrayBuffer.prototype.grow (newLength )
        4. 25.2.5.4 get SharedArrayBuffer.prototype.growable
        5. 25.2.5.5 get SharedArrayBuffer.prototype.maxByteLength
        6. 25.2.5.6 SharedArrayBuffer.prototype.slice (start,end )
        7. 25.2.5.7 SharedArrayBuffer.prototype [ %Symbol.toStringTag% ]
      6. 25.2.6 Properties of SharedArrayBuffer Instances
      7. 25.2.7 Growable SharedArrayBuffer Guidelines
    3. +25.3 DataView Objects
      1. +25.3.1 Abstract Operations For DataView Objects
        1. 25.3.1.1 DataView With Buffer Witness Records
        2. 25.3.1.2 MakeDataViewWithBufferWitnessRecord (obj,order )
        3. 25.3.1.3 GetViewByteLength (viewRecord )
        4. 25.3.1.4 IsViewOutOfBounds (viewRecord )
        5. 25.3.1.5 GetViewValue (view,requestIndex,isLittleEndian,type )
        6. 25.3.1.6 SetViewValue (view,requestIndex,isLittleEndian,type,value )
      2. +25.3.2 The DataView Constructor
        1. 25.3.2.1 DataView (buffer [ ,byteOffset [ ,byteLength ] ] )
      3. +25.3.3 Properties of the DataView Constructor
        1. 25.3.3.1 DataView.prototype
      4. +25.3.4 Properties of the DataView Prototype Object
        1. 25.3.4.1 get DataView.prototype.buffer
        2. 25.3.4.2 get DataView.prototype.byteLength
        3. 25.3.4.3 get DataView.prototype.byteOffset
        4. 25.3.4.4 DataView.prototype.constructor
        5. 25.3.4.5 DataView.prototype.getBigInt64 (byteOffset [ ,littleEndian ] )
        6. 25.3.4.6 DataView.prototype.getBigUint64 (byteOffset [ ,littleEndian ] )
        7. 25.3.4.7 DataView.prototype.getFloat16 (byteOffset [ ,littleEndian ] )
        8. 25.3.4.8 DataView.prototype.getFloat32 (byteOffset [ ,littleEndian ] )
        9. 25.3.4.9 DataView.prototype.getFloat64 (byteOffset [ ,littleEndian ] )
        10. 25.3.4.10 DataView.prototype.getInt8 (byteOffset )
        11. 25.3.4.11 DataView.prototype.getInt16 (byteOffset [ ,littleEndian ] )
        12. 25.3.4.12 DataView.prototype.getInt32 (byteOffset [ ,littleEndian ] )
        13. 25.3.4.13 DataView.prototype.getUint8 (byteOffset )
        14. 25.3.4.14 DataView.prototype.getUint16 (byteOffset [ ,littleEndian ] )
        15. 25.3.4.15 DataView.prototype.getUint32 (byteOffset [ ,littleEndian ] )
        16. 25.3.4.16 DataView.prototype.setBigInt64 (byteOffset,value [ ,littleEndian ] )
        17. 25.3.4.17 DataView.prototype.setBigUint64 (byteOffset,value [ ,littleEndian ] )
        18. 25.3.4.18 DataView.prototype.setFloat16 (byteOffset,value [ ,littleEndian ] )
        19. 25.3.4.19 DataView.prototype.setFloat32 (byteOffset,value [ ,littleEndian ] )
        20. 25.3.4.20 DataView.prototype.setFloat64 (byteOffset,value [ ,littleEndian ] )
        21. 25.3.4.21 DataView.prototype.setInt8 (byteOffset,value )
        22. 25.3.4.22 DataView.prototype.setInt16 (byteOffset,value [ ,littleEndian ] )
        23. 25.3.4.23 DataView.prototype.setInt32 (byteOffset,value [ ,littleEndian ] )
        24. 25.3.4.24 DataView.prototype.setUint8 (byteOffset,value )
        25. 25.3.4.25 DataView.prototype.setUint16 (byteOffset,value [ ,littleEndian ] )
        26. 25.3.4.26 DataView.prototype.setUint32 (byteOffset,value [ ,littleEndian ] )
        27. 25.3.4.27 DataView.prototype [ %Symbol.toStringTag% ]
      5. 25.3.5 Properties of DataView Instances
    4. +25.4 The Atomics Object
      1. 25.4.1 Waiter Record
      2. 25.4.2 WaiterList Records
      3. +25.4.3 Abstract Operations for Atomics
        1. 25.4.3.1 ValidateIntegerTypedArray (typedArray,waitable )
        2. 25.4.3.2 ValidateAtomicAccess (taRecord,requestIndex )
        3. 25.4.3.3 ValidateAtomicAccessOnIntegerTypedArray (typedArray,requestIndex )
        4. 25.4.3.4 RevalidateAtomicAccess (typedArray,byteIndexInBuffer )
        5. 25.4.3.5 GetWaiterList (block,i )
        6. 25.4.3.6 EnterCriticalSection (WL )
        7. 25.4.3.7 LeaveCriticalSection (WL )
        8. 25.4.3.8 AddWaiter (WL,waiterRecord )
        9. 25.4.3.9 RemoveWaiter (WL,waiterRecord )
        10. 25.4.3.10 RemoveWaiters (WL,c )
        11. 25.4.3.11 SuspendThisAgent (WL,waiterRecord )
        12. 25.4.3.12 NotifyWaiter (WL,waiterRecord )
        13. 25.4.3.13 EnqueueResolveInAgentJob (agentSignifier,promiseCapability,resolution )
        14. 25.4.3.14 DoWait (mode,typedArray,index,value,timeout )
        15. 25.4.3.15 EnqueueAtomicsWaitAsyncTimeoutJob (WL,waiterRecord )
        16. 25.4.3.16 AtomicCompareExchangeInSharedBlock (block,byteIndexInBuffer,elementSize,expectedBytes,replacementBytes )
        17. 25.4.3.17 AtomicReadModifyWrite (typedArray,index,value,op )
        18. 25.4.3.18 ByteListBitwiseOp (op,xBytes,yBytes )
        19. 25.4.3.19 ByteListEqual (xBytes,yBytes )
      4. 25.4.4 Atomics.add (typedArray,index,value )
      5. 25.4.5 Atomics.and (typedArray,index,value )
      6. 25.4.6 Atomics.compareExchange (typedArray,index,expectedValue,replacementValue )
      7. 25.4.7 Atomics.exchange (typedArray,index,value )
      8. 25.4.8 Atomics.isLockFree (size )
      9. 25.4.9 Atomics.load (typedArray,index )
      10. 25.4.10 Atomics.or (typedArray,index,value )
      11. 25.4.11 Atomics.store (typedArray,index,value )
      12. 25.4.12 Atomics.sub (typedArray,index,value )
      13. 25.4.13 Atomics.wait (typedArray,index,value,timeout )
      14. 25.4.14 Atomics.waitAsync (typedArray,index,value,timeout )
      15. 25.4.15 Atomics.notify (typedArray,index,count )
      16. 25.4.16 Atomics.xor (typedArray,index,value )
      17. 25.4.17 Atomics [ %Symbol.toStringTag% ]
    5. +25.5 The JSON Object
      1. +25.5.1 JSON.parse (text [ ,reviver ] )
        1. 25.5.1.1 ParseJSON (text )
        2. 25.5.1.2 InternalizeJSONProperty (holder,name,reviver )
      2. +25.5.2 JSON.stringify (value [ ,replacer [ ,space ] ] )
        1. 25.5.2.1 JSON Serialization Record
        2. 25.5.2.2 SerializeJSONProperty (state,key,holder )
        3. 25.5.2.3 QuoteJSONString (value )
        4. 25.5.2.4 UnicodeEscape (C )
        5. 25.5.2.5 SerializeJSONObject (state,value )
        6. 25.5.2.6 SerializeJSONArray (state,value )
      3. 25.5.3 JSON [ %Symbol.toStringTag% ]
  27. +26 Managing Memory
    1. +26.1 WeakRef Objects
      1. +26.1.1 The WeakRef Constructor
        1. 26.1.1.1 WeakRef (target )
      2. +26.1.2 Properties of the WeakRef Constructor
        1. 26.1.2.1 WeakRef.prototype
      3. +26.1.3 Properties of the WeakRef Prototype Object
        1. 26.1.3.1 WeakRef.prototype.constructor
        2. 26.1.3.2 WeakRef.prototype.deref ( )
        3. 26.1.3.3 WeakRef.prototype [ %Symbol.toStringTag% ]
      4. +26.1.4 WeakRef Abstract Operations
        1. 26.1.4.1 WeakRefDeref (weakRef )
      5. 26.1.5 Properties of WeakRef Instances
    2. +26.2 FinalizationRegistry Objects
      1. +26.2.1 The FinalizationRegistry Constructor
        1. 26.2.1.1 FinalizationRegistry (cleanupCallback )
      2. +26.2.2 Properties of the FinalizationRegistry Constructor
        1. 26.2.2.1 FinalizationRegistry.prototype
      3. +26.2.3 Properties of the FinalizationRegistry Prototype Object
        1. 26.2.3.1 FinalizationRegistry.prototype.constructor
        2. 26.2.3.2 FinalizationRegistry.prototype.register (target,heldValue [ ,unregisterToken ] )
        3. 26.2.3.3 FinalizationRegistry.prototype.unregister (unregisterToken )
        4. 26.2.3.4 FinalizationRegistry.prototype [ %Symbol.toStringTag% ]
      4. 26.2.4 Properties of FinalizationRegistry Instances
  28. +27 Control Abstraction Objects
    1. +27.1 Iteration
      1. +27.1.1 Common Iteration Interfaces
        1. 27.1.1.1 The Iterable Interface
        2. 27.1.1.2 The Iterator Interface
        3. 27.1.1.3 The Async Iterable Interface
        4. 27.1.1.4 The Async Iterator Interface
        5. 27.1.1.5 The IteratorResult Interface
      2. +27.1.2 Iterator Helper Objects
        1. +27.1.2.1 The %IteratorHelperPrototype% Object
          1. 27.1.2.1.1 %IteratorHelperPrototype%.next ( )
          2. 27.1.2.1.2 %IteratorHelperPrototype%.return ( )
          3. 27.1.2.1.3 %IteratorHelperPrototype% [ %Symbol.toStringTag% ]
      3. +27.1.3 Iterator Objects
        1. +27.1.3.1 The Iterator Constructor
          1. 27.1.3.1.1 Iterator ( )
        2. +27.1.3.2 Properties of the Iterator Constructor
          1. +27.1.3.2.1 Iterator.from (O )
            1. +27.1.3.2.1.1 The %WrapForValidIteratorPrototype% Object
              1. 27.1.3.2.1.1.1 %WrapForValidIteratorPrototype%.next ( )
              2. 27.1.3.2.1.1.2 %WrapForValidIteratorPrototype%.return ( )
          2. 27.1.3.2.2 Iterator.prototype
        3. +27.1.3.3 Properties of the Iterator Prototype Object
          1. +27.1.3.3.1 Iterator.prototype.constructor
            1. 27.1.3.3.1.1 get Iterator.prototype.constructor
            2. 27.1.3.3.1.2 set Iterator.prototype.constructor
          2. 27.1.3.3.2 Iterator.prototype.drop (limit )
          3. 27.1.3.3.3 Iterator.prototype.every (predicate )
          4. 27.1.3.3.4 Iterator.prototype.filter (predicate )
          5. 27.1.3.3.5 Iterator.prototype.find (predicate )
          6. 27.1.3.3.6 Iterator.prototype.flatMap (mapper )
          7. 27.1.3.3.7 Iterator.prototype.forEach (procedure )
          8. 27.1.3.3.8 Iterator.prototype.map (mapper )
          9. 27.1.3.3.9 Iterator.prototype.reduce (reducer [ ,initialValue ] )
          10. 27.1.3.3.10 Iterator.prototype.some (predicate )
          11. 27.1.3.3.11 Iterator.prototype.take (limit )
          12. 27.1.3.3.12 Iterator.prototype.toArray ( )
          13. 27.1.3.3.13 Iterator.prototype [ %Symbol.iterator% ] ( )
          14. +27.1.3.3.14 Iterator.prototype [ %Symbol.toStringTag% ]
            1. 27.1.3.3.14.1 get Iterator.prototype [ %Symbol.toStringTag% ]
            2. 27.1.3.3.14.2 set Iterator.prototype [ %Symbol.toStringTag% ]
      4. +27.1.4 The %AsyncIteratorPrototype% Object
        1. 27.1.4.1 %AsyncIteratorPrototype% [ %Symbol.asyncIterator% ] ( )
      5. +27.1.5 Async-from-Sync Iterator Objects
        1. 27.1.5.1 CreateAsyncFromSyncIterator (syncIteratorRecord )
        2. +27.1.5.2 The %AsyncFromSyncIteratorPrototype% Object
          1. 27.1.5.2.1 %AsyncFromSyncIteratorPrototype%.next ( [value ] )
          2. 27.1.5.2.2 %AsyncFromSyncIteratorPrototype%.return ( [value ] )
          3. 27.1.5.2.3 %AsyncFromSyncIteratorPrototype%.throw ( [value ] )
        3. 27.1.5.3 Properties of Async-from-Sync Iterator Instances
        4. 27.1.5.4 AsyncFromSyncIteratorContinuation (result,promiseCapability,syncIteratorRecord,closeOnRejection )
    2. +27.2 Promise Objects
      1. +27.2.1 Promise Abstract Operations
        1. +27.2.1.1 PromiseCapability Records
          1. 27.2.1.1.1 IfAbruptRejectPromise (value,capability )
        2. 27.2.1.2 PromiseReaction Records
        3. +27.2.1.3 CreateResolvingFunctions (promise )
          1. 27.2.1.3.1 Promise Reject Functions
          2. 27.2.1.3.2 Promise Resolve Functions
        4. 27.2.1.4 FulfillPromise (promise,value )
        5. 27.2.1.5 NewPromiseCapability (C )
        6. 27.2.1.6 IsPromise (x )
        7. 27.2.1.7 RejectPromise (promise,reason )
        8. 27.2.1.8 TriggerPromiseReactions (reactions,argument )
        9. 27.2.1.9 HostPromiseRejectionTracker (promise,operation )
      2. +27.2.2 Promise Jobs
        1. 27.2.2.1 NewPromiseReactionJob (reaction,argument )
        2. 27.2.2.2 NewPromiseResolveThenableJob (promiseToResolve,thenable,then )
      3. +27.2.3 The Promise Constructor
        1. 27.2.3.1 Promise (executor )
      4. +27.2.4 Properties of the Promise Constructor
        1. +27.2.4.1 Promise.all (iterable )
          1. 27.2.4.1.1 GetPromiseResolve (promiseConstructor )
          2. 27.2.4.1.2 PerformPromiseAll (iteratorRecord,constructor,resultCapability,promiseResolve )
          3. 27.2.4.1.3Promise.all Resolve Element Functions
        2. +27.2.4.2 Promise.allSettled (iterable )
          1. 27.2.4.2.1 PerformPromiseAllSettled (iteratorRecord,constructor,resultCapability,promiseResolve )
          2. 27.2.4.2.2Promise.allSettled Resolve Element Functions
          3. 27.2.4.2.3Promise.allSettled Reject Element Functions
        3. +27.2.4.3 Promise.any (iterable )
          1. 27.2.4.3.1 PerformPromiseAny (iteratorRecord,constructor,resultCapability,promiseResolve )
          2. 27.2.4.3.2Promise.any Reject Element Functions
        4. 27.2.4.4 Promise.prototype
        5. +27.2.4.5 Promise.race (iterable )
          1. 27.2.4.5.1 PerformPromiseRace (iteratorRecord,constructor,resultCapability,promiseResolve )
        6. 27.2.4.6 Promise.reject (r )
        7. +27.2.4.7 Promise.resolve (x )
          1. 27.2.4.7.1 PromiseResolve (C,x )
        8. 27.2.4.8 Promise.try (callback, ...args )
        9. 27.2.4.9 Promise.withResolvers ( )
        10. 27.2.4.10 get Promise [ %Symbol.species% ]
      5. +27.2.5 Properties of the Promise Prototype Object
        1. 27.2.5.1 Promise.prototype.catch (onRejected )
        2. 27.2.5.2 Promise.prototype.constructor
        3. 27.2.5.3 Promise.prototype.finally (onFinally )
        4. +27.2.5.4 Promise.prototype.then (onFulfilled,onRejected )
          1. 27.2.5.4.1 PerformPromiseThen (promise,onFulfilled,onRejected [ ,resultCapability ] )
        5. 27.2.5.5 Promise.prototype [ %Symbol.toStringTag% ]
      6. 27.2.6 Properties of Promise Instances
    3. +27.3 GeneratorFunction Objects
      1. +27.3.1 The GeneratorFunction Constructor
        1. 27.3.1.1 GeneratorFunction ( ...parameterArgs,bodyArg )
      2. +27.3.2 Properties of the GeneratorFunction Constructor
        1. 27.3.2.1 GeneratorFunction.prototype
      3. +27.3.3 Properties of the GeneratorFunction Prototype Object
        1. 27.3.3.1 GeneratorFunction.prototype.constructor
        2. 27.3.3.2 GeneratorFunction.prototype.prototype
        3. 27.3.3.3 GeneratorFunction.prototype [ %Symbol.toStringTag% ]
      4. +27.3.4 GeneratorFunction Instances
        1. 27.3.4.1 length
        2. 27.3.4.2 name
        3. 27.3.4.3 prototype
    4. +27.4 AsyncGeneratorFunction Objects
      1. +27.4.1 The AsyncGeneratorFunction Constructor
        1. 27.4.1.1 AsyncGeneratorFunction ( ...parameterArgs,bodyArg )
      2. +27.4.2 Properties of the AsyncGeneratorFunction Constructor
        1. 27.4.2.1 AsyncGeneratorFunction.prototype
      3. +27.4.3 Properties of the AsyncGeneratorFunction Prototype Object
        1. 27.4.3.1 AsyncGeneratorFunction.prototype.constructor
        2. 27.4.3.2 AsyncGeneratorFunction.prototype.prototype
        3. 27.4.3.3 AsyncGeneratorFunction.prototype [ %Symbol.toStringTag% ]
      4. +27.4.4 AsyncGeneratorFunction Instances
        1. 27.4.4.1 length
        2. 27.4.4.2 name
        3. 27.4.4.3 prototype
    5. +27.5 Generator Objects
      1. +27.5.1 The %GeneratorPrototype% Object
        1. 27.5.1.1 %GeneratorPrototype%.constructor
        2. 27.5.1.2 %GeneratorPrototype%.next (value )
        3. 27.5.1.3 %GeneratorPrototype%.return (value )
        4. 27.5.1.4 %GeneratorPrototype%.throw (exception )
        5. 27.5.1.5 %GeneratorPrototype% [ %Symbol.toStringTag% ]
      2. 27.5.2 Properties of Generator Instances
      3. +27.5.3 Generator Abstract Operations
        1. 27.5.3.1 GeneratorStart (generator,generatorBody )
        2. 27.5.3.2 GeneratorValidate (generator,generatorBrand )
        3. 27.5.3.3 GeneratorResume (generator,value,generatorBrand )
        4. 27.5.3.4 GeneratorResumeAbrupt (generator,abruptCompletion,generatorBrand )
        5. 27.5.3.5 GetGeneratorKind ( )
        6. 27.5.3.6 GeneratorYield (iteratorResult )
        7. 27.5.3.7 Yield (value )
        8. 27.5.3.8 CreateIteratorFromClosure (closure,generatorBrand,generatorPrototype [ ,extraSlots ] )
    6. +27.6 AsyncGenerator Objects
      1. +27.6.1 The %AsyncGeneratorPrototype% Object
        1. 27.6.1.1 %AsyncGeneratorPrototype%.constructor
        2. 27.6.1.2 %AsyncGeneratorPrototype%.next (value )
        3. 27.6.1.3 %AsyncGeneratorPrototype%.return (value )
        4. 27.6.1.4 %AsyncGeneratorPrototype%.throw (exception )
        5. 27.6.1.5 %AsyncGeneratorPrototype% [ %Symbol.toStringTag% ]
      2. 27.6.2 Properties of AsyncGenerator Instances
      3. +27.6.3 AsyncGenerator Abstract Operations
        1. 27.6.3.1 AsyncGeneratorRequest Records
        2. 27.6.3.2 AsyncGeneratorStart (generator,generatorBody )
        3. 27.6.3.3 AsyncGeneratorValidate (generator,generatorBrand )
        4. 27.6.3.4 AsyncGeneratorEnqueue (generator,completion,promiseCapability )
        5. 27.6.3.5 AsyncGeneratorCompleteStep (generator,completion,done [ ,realm ] )
        6. 27.6.3.6 AsyncGeneratorResume (generator,completion )
        7. 27.6.3.7 AsyncGeneratorUnwrapYieldResumption (resumptionValue )
        8. 27.6.3.8 AsyncGeneratorYield (value )
        9. 27.6.3.9 AsyncGeneratorAwaitReturn (generator )
        10. 27.6.3.10 AsyncGeneratorDrainQueue (generator )
        11. 27.6.3.11 CreateAsyncIteratorFromClosure (closure,generatorBrand,generatorPrototype )
    7. +27.7 AsyncFunction Objects
      1. +27.7.1 The AsyncFunction Constructor
        1. 27.7.1.1 AsyncFunction ( ...parameterArgs,bodyArg )
      2. +27.7.2 Properties of the AsyncFunction Constructor
        1. 27.7.2.1 AsyncFunction.prototype
      3. +27.7.3 Properties of the AsyncFunction Prototype Object
        1. 27.7.3.1 AsyncFunction.prototype.constructor
        2. 27.7.3.2 AsyncFunction.prototype [ %Symbol.toStringTag% ]
      4. +27.7.4 AsyncFunction Instances
        1. 27.7.4.1 length
        2. 27.7.4.2 name
      5. +27.7.5 Async Functions Abstract Operations
        1. 27.7.5.1 AsyncFunctionStart (promiseCapability,asyncFunctionBody )
        2. 27.7.5.2 AsyncBlockStart (promiseCapability,asyncBody,asyncContext )
        3. 27.7.5.3 Await (value )
  29. +28 Reflection
    1. +28.1 The Reflect Object
      1. 28.1.1 Reflect.apply (target,thisArgument,argumentsList )
      2. 28.1.2 Reflect.construct (target,argumentsList [ ,newTarget ] )
      3. 28.1.3 Reflect.defineProperty (target,propertyKey,attributes )
      4. 28.1.4 Reflect.deleteProperty (target,propertyKey )
      5. 28.1.5 Reflect.get (target,propertyKey [ ,receiver ] )
      6. 28.1.6 Reflect.getOwnPropertyDescriptor (target,propertyKey )
      7. 28.1.7 Reflect.getPrototypeOf (target )
      8. 28.1.8 Reflect.has (target,propertyKey )
      9. 28.1.9 Reflect.isExtensible (target )
      10. 28.1.10 Reflect.ownKeys (target )
      11. 28.1.11 Reflect.preventExtensions (target )
      12. 28.1.12 Reflect.set (target,propertyKey,V [ ,receiver ] )
      13. 28.1.13 Reflect.setPrototypeOf (target,proto )
      14. 28.1.14 Reflect [ %Symbol.toStringTag% ]
    2. +28.2 Proxy Objects
      1. +28.2.1 The Proxy Constructor
        1. 28.2.1.1 Proxy (target,handler )
      2. +28.2.2 Properties of the Proxy Constructor
        1. 28.2.2.1 Proxy.revocable (target,handler )
    3. +28.3 Module Namespace Objects
      1. 28.3.1 %Symbol.toStringTag%
  30. +29 Memory Model
    1. 29.1 Memory Model Fundamentals
    2. 29.2 Agent Events Records
    3. 29.3 Chosen Value Records
    4. 29.4 Candidate Executions
    5. +29.5 Abstract Operations for the Memory Model
      1. 29.5.1 EventSet (execution )
      2. 29.5.2 SharedDataBlockEventSet (execution )
      3. 29.5.3 HostEventSet (execution )
      4. 29.5.4 ComposeWriteEventBytes (execution,byteIndex,Ws )
      5. 29.5.5 ValueOfReadEvent (execution,R )
    6. +29.6 Relations of Candidate Executions
      1. 29.6.1 is-agent-order-before
      2. 29.6.2 reads-bytes-from
      3. 29.6.3 reads-from
      4. 29.6.4 host-synchronizes-with
      5. 29.6.5 synchronizes-with
      6. 29.6.6 happens-before
    7. +29.7 Properties of Valid Executions
      1. 29.7.1 Valid Chosen Reads
      2. 29.7.2 Coherent Reads
      3. 29.7.3 Tear Free Reads
      4. 29.7.4 Sequentially Consistent Atomics
      5. 29.7.5 Valid Executions
    8. 29.8 Races
    9. 29.9 Data Races
    10. 29.10 Data Race Freedom
    11. 29.11 Shared Memory Guidelines
  31. +Annex A(informative) Grammar Summary
    1. A.1 Lexical Grammar
    2. A.2 Expressions
    3. A.3 Statements
    4. A.4 Functions and Classes
    5. A.5 Scripts and Modules
    6. A.6 Number Conversions
    7. A.7 Time Zone Offset String Format
    8. A.8 Regular Expressions
  32. +Annex B(normative) Additional ECMAScript Features for Web Browsers
    1. +B.1 Additional Syntax
      1. B.1.1 HTML-like Comments
      2. +B.1.2 Regular Expressions Patterns
        1. B.1.2.1 SS: Early Errors
        2. B.1.2.2 SS: CountLeftCapturingParensWithin and CountLeftCapturingParensBefore
        3. B.1.2.3 SS: IsCharacterClass
        4. B.1.2.4 SS: CharacterValue
        5. B.1.2.5 RS: CompileSubpattern
        6. B.1.2.6 RS: CompileAssertion
        7. B.1.2.7 RS: CompileAtom
        8. +B.1.2.8 RS: CompileToCharSet
          1. B.1.2.8.1 CharacterRangeOrUnion (rer,A,B )
        9. B.1.2.9 SS: ParsePattern (patternText,u,v )
    2. +B.2 Additional Built-in Properties
      1. +B.2.1 Additional Properties of the Global Object
        1. B.2.1.1 escape (string )
        2. B.2.1.2 unescape (string )
      2. +B.2.2 Additional Properties of the String.prototype Object
        1. B.2.2.1 String.prototype.substr (start,length )
        2. +B.2.2.2 String.prototype.anchor (name )
          1. B.2.2.2.1 CreateHTML (string,tag,attribute,value )
        3. B.2.2.3 String.prototype.big ( )
        4. B.2.2.4 String.prototype.blink ( )
        5. B.2.2.5 String.prototype.bold ( )
        6. B.2.2.6 String.prototype.fixed ( )
        7. B.2.2.7 String.prototype.fontcolor (colour )
        8. B.2.2.8 String.prototype.fontsize (size )
        9. B.2.2.9 String.prototype.italics ( )
        10. B.2.2.10 String.prototype.link (url )
        11. B.2.2.11 String.prototype.small ( )
        12. B.2.2.12 String.prototype.strike ( )
        13. B.2.2.13 String.prototype.sub ( )
        14. B.2.2.14 String.prototype.sup ( )
        15. B.2.2.15 String.prototype.trimLeft ( )
        16. B.2.2.16 String.prototype.trimRight ( )
      3. +B.2.3 Additional Properties of the Date.prototype Object
        1. B.2.3.1 Date.prototype.getYear ( )
        2. B.2.3.2 Date.prototype.setYear (year )
        3. B.2.3.3 Date.prototype.toGMTString ( )
      4. +B.2.4 Additional Properties of the RegExp.prototype Object
        1. B.2.4.1 RegExp.prototype.compile (pattern,flags )
    3. +B.3 Other Additional Features
      1. B.3.1 Labelled Function Declarations
      2. B.3.2 Block-Level Function Declarations Web Legacy Compatibility Semantics
      3. B.3.3 FunctionDeclarations in IfStatement Statement Clauses
      4. B.3.4 VariableStatements in Catch Blocks
      5. B.3.5 Initializers in ForIn Statement Heads
      6. B.3.6 The[[IsHTMLDDA]] Internal Slot
      7. B.3.7 Non-default behaviour in HostMakeJobCallback
      8. B.3.8 Non-default behaviour in HostEnsureCanAddPrivateElement
      9. B.3.9 Runtime Errors for Function Call Assignment Targets
  33. Annex C(informative) The Strict Mode of ECMAScript
  34. +Annex D(informative) Host Layering Points
    1. D.1 Host Hooks
    2. D.2 Host-defined Fields
    3. D.3 Host-defined Objects
    4. D.4 Running Jobs
    5. D.5 Internal Methods of Exotic Objects
    6. D.6 Built-in Objects and Methods
  35. Annex E(informative) Corrections and Clarifications in ECMAScript 2015 with Possible Compatibility Impact
  36. Annex F(informative) Additions and Changes That Introduce Incompatibilities with Prior Editions
  37. Bibliography
  38. Colophon
  39. Copyright & Software License
Menu

23 Indexed Collections

23.1 Array Objects

Arrays areexotic objects that give special treatment to a certain class ofproperty names. See10.4.2 for a definition of this special treatment.

23.1.1 The Array Constructor

The Arrayconstructor:

  • is%Array%.
  • is the initial value of the"Array" property of theglobal object.
  • creates and initializes a new Array when called as aconstructor.
  • also creates and initializes a new Array when called as a function rather than as aconstructor. Thus the function callArray(…) is equivalent to the object creation expressionnew Array(…) with the same arguments.
  • is a function whose behaviour differs based upon the number and types of its arguments.
  • may be used as the value of anextends clause of a class definition. Subclassconstructors that intend to inherit the exotic Array behaviour must include asuper call to the Arrayconstructor to initialize subclass instances that areArray exotic objects. However, most of theArray.prototype methods are generic methods that are not dependent upon theirthis value being anArray exotic object.

23.1.1.1 Array ( ...values )

This function performs the following steps when called:

  1. If NewTarget isundefined, letnewTarget be theactive function object; else letnewTarget be NewTarget.
  2. Letproto be ? GetPrototypeFromConstructor(newTarget,"%Array.prototype%").
  3. LetnumberOfArgs be the number of elements invalues.
  4. IfnumberOfArgs = 0, then
    1. Return ! ArrayCreate(0,proto).
  5. Else ifnumberOfArgs = 1, then
    1. Letlen bevalues[0].
    2. Letarray be ! ArrayCreate(0,proto).
    3. Iflenis not a Number, then
      1. Perform ! CreateDataPropertyOrThrow(array,"0",len).
      2. LetintLen be1𝔽.
    4. Else,
      1. LetintLen be ! ToUint32(len).
      2. IfSameValueZero(intLen,len) isfalse, throw aRangeError exception.
    5. Perform ! Set(array,"length",intLen,true).
    6. Returnarray.
  6. Else,
    1. Assert:numberOfArgs ≥ 2.
    2. Letarray be ? ArrayCreate(numberOfArgs,proto).
    3. Letk be 0.
    4. Repeat, whilek <numberOfArgs,
      1. LetPk be ! ToString(𝔽(k)).
      2. LetitemK bevalues[k].
      3. Perform ! CreateDataPropertyOrThrow(array,Pk,itemK).
      4. Setk tok + 1.
    5. Assert: Themathematical value ofarray's"length" property isnumberOfArgs.
    6. Returnarray.

23.1.2 Properties of the Array Constructor

The Arrayconstructor:

  • has a[[Prototype]] internal slot whose value is%Function.prototype%.
  • has a"length" property whose value is1𝔽.
  • has the following properties:

23.1.2.1 Array.from (items [ ,mapper [ ,thisArg ] ] )

This method performs the following steps when called:

  1. LetC be thethis value.
  2. Ifmapper isundefined, then
    1. Letmapping befalse.
  3. Else,
    1. IfIsCallable(mapper) isfalse, throw aTypeError exception.
    2. Letmapping betrue.
  4. LetusingIterator be ? GetMethod(items,%Symbol.iterator%).
  5. IfusingIterator is notundefined, then
    1. IfIsConstructor(C) istrue, then
      1. LetA be ? Construct(C).
    2. Else,
      1. LetA be ! ArrayCreate(0).
    3. LetiteratorRecord be ? GetIteratorFromMethod(items,usingIterator).
    4. Letk be 0.
    5. Repeat,
      1. Ifk ≥ 253 - 1, then
        1. Leterror beThrowCompletion(a newly createdTypeError object).
        2. Return ? IteratorClose(iteratorRecord,error).
      2. LetPk be ! ToString(𝔽(k)).
      3. Letnext be ? IteratorStepValue(iteratorRecord).
      4. Ifnext isdone, then
        1. Perform ? Set(A,"length",𝔽(k),true).
        2. ReturnA.
      5. Ifmapping istrue, then
        1. LetmappedValue beCompletion(Call(mapper,thisArg, «next,𝔽(k) »)).
        2. IfAbruptCloseIterator(mappedValue,iteratorRecord).
      6. Else,
        1. LetmappedValue benext.
      7. LetdefineStatus beCompletion(CreateDataPropertyOrThrow(A,Pk,mappedValue)).
      8. IfAbruptCloseIterator(defineStatus,iteratorRecord).
      9. Setk tok + 1.
  6. NOTE:items is notiterable so assume it is anarray-like object.
  7. LetarrayLike be ! ToObject(items).
  8. Letlen be ? LengthOfArrayLike(arrayLike).
  9. IfIsConstructor(C) istrue, then
    1. LetA be ? Construct(C, «𝔽(len) »).
  10. Else,
    1. LetA be ? ArrayCreate(len).
  11. Letk be 0.
  12. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ? Get(arrayLike,Pk).
    3. Ifmapping istrue, then
      1. LetmappedValue be ? Call(mapper,thisArg, «kValue,𝔽(k) »).
    4. Else,
      1. LetmappedValue bekValue.
    5. Perform ? CreateDataPropertyOrThrow(A,Pk,mappedValue).
    6. Setk tok + 1.
  13. Perform ? Set(A,"length",𝔽(len),true).
  14. ReturnA.
Note

This method is an intentionally generic factory method; it does not require that itsthis value be the Arrayconstructor. Therefore it can be transferred to or inherited by any otherconstructors that may be called with a single numeric argument.

23.1.2.2 Array.isArray (arg )

This function performs the following steps when called:

  1. Return ? IsArray(arg).

23.1.2.3 Array.of ( ...items )

This method performs the following steps when called:

  1. Letlen be the number of elements initems.
  2. LetlenNumber be𝔽(len).
  3. LetC be thethis value.
  4. IfIsConstructor(C) istrue, then
    1. LetA be ? Construct(C, «lenNumber »).
  5. Else,
    1. LetA be ? ArrayCreate(len).
  6. Letk be 0.
  7. Repeat, whilek <len,
    1. LetkValue beitems[k].
    2. LetPk be ! ToString(𝔽(k)).
    3. Perform ? CreateDataPropertyOrThrow(A,Pk,kValue).
    4. Setk tok + 1.
  8. Perform ? Set(A,"length",lenNumber,true).
  9. ReturnA.
Note

This method is an intentionally generic factory method; it does not require that itsthis value be the Arrayconstructor. Therefore it can be transferred to or inherited by otherconstructors that may be called with a single numeric argument.

23.1.2.4 Array.prototype

The value ofArray.prototype is theArray prototype object.

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:false }.

23.1.2.5 get Array [ %Symbol.species% ]

Array[%Symbol.species%] is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. Return thethis value.

The value of the"name" property of this function is"get [Symbol.species]".

Note

Array prototype methods normally use theirthis value'sconstructor to create a derived object. However, a subclassconstructor may over-ride that default behaviour by redefining its%Symbol.species% property.

23.1.3 Properties of the Array Prototype Object

TheArray prototype object:

  • is%Array.prototype%.
  • is anArray exotic object and has the internal methods specified for such objects.
  • has a"length" property whose initial value is+0𝔽 and whose attributes are {[[Writable]]:true,[[Enumerable]]:false,[[Configurable]]:false }.
  • has a[[Prototype]] internal slot whose value is%Object.prototype%.
Note

The Array prototype object is specified to be anArray exotic object to ensure compatibility with ECMAScript code that was created prior to the ECMAScript 2015 specification.

23.1.3.1 Array.prototype.at (index )

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeIndex be ? ToIntegerOrInfinity(index).
  4. IfrelativeIndex ≥ 0, then
    1. Letk berelativeIndex.
  5. Else,
    1. Letk belen +relativeIndex.
  6. Ifk < 0 orklen, returnundefined.
  7. Return ? Get(O, ! ToString(𝔽(k))).

23.1.3.2 Array.prototype.concat ( ...items )

This method returns an array containing the array elements of the object followed by the array elements of each argument.

It performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. LetA be ? ArraySpeciesCreate(O, 0).
  3. Letn be 0.
  4. PrependO toitems.
  5. For each elementE ofitems, do
    1. Letspreadable be ? IsConcatSpreadable(E).
    2. Ifspreadable istrue, then
      1. Letlen be ? LengthOfArrayLike(E).
      2. Ifn +len > 253 - 1, throw aTypeError exception.
      3. Letk be 0.
      4. Repeat, whilek <len,
        1. LetPk be ! ToString(𝔽(k)).
        2. Letexists be ? HasProperty(E,Pk).
        3. Ifexists istrue, then
          1. LetsubElement be ? Get(E,Pk).
          2. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)),subElement).
        4. Setn ton + 1.
        5. Setk tok + 1.
    3. Else,
      1. NOTE:E is added as a single item rather than spread.
      2. Ifn ≥ 253 - 1, throw aTypeError exception.
      3. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)),E).
      4. Setn ton + 1.
  6. Perform ? Set(A,"length",𝔽(n),true).
  7. ReturnA.

The"length" property of this method is1𝔽.

Note 1

The explicit setting of the"length" property in step6 is intended to ensure the length is correct when the final non-empty element ofitems has trailing holes or whenA is not a built-in Array.

Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.2.1 IsConcatSpreadable (O )

The abstract operation IsConcatSpreadable takes argumentO (anECMAScript language value) and returns either anormal completion containing a Boolean or athrow completion. It performs the following steps when called:

  1. IfOis not an Object, returnfalse.
  2. Letspreadable be ? Get(O,%Symbol.isConcatSpreadable%).
  3. Ifspreadable is notundefined, returnToBoolean(spreadable).
  4. Return ? IsArray(O).

23.1.3.3 Array.prototype.constructor

The initial value ofArray.prototype.constructor is%Array%.

23.1.3.4 Array.prototype.copyWithin (target,start [ ,end ] )

Note 1

Theend argument is optional. If it is not provided, the length of thethis value is used.

Note 2

Iftarget is negative, it is treated aslength +target wherelength is the length of the array. Ifstart is negative, it is treated aslength +start. Ifend is negative, it is treated aslength +end.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeTarget be ? ToIntegerOrInfinity(target).
  4. IfrelativeTarget = -∞, letto be 0.
  5. Else ifrelativeTarget < 0, letto bemax(len +relativeTarget, 0).
  6. Else, letto bemin(relativeTarget,len).
  7. LetrelativeStart be ? ToIntegerOrInfinity(start).
  8. IfrelativeStart = -∞, letfrom be 0.
  9. Else ifrelativeStart < 0, letfrom bemax(len +relativeStart, 0).
  10. Else, letfrom bemin(relativeStart,len).
  11. Ifend isundefined, letrelativeEnd belen; else letrelativeEnd be ? ToIntegerOrInfinity(end).
  12. IfrelativeEnd = -∞, letfinal be 0.
  13. Else ifrelativeEnd < 0, letfinal bemax(len +relativeEnd, 0).
  14. Else, letfinal bemin(relativeEnd,len).
  15. Letcount bemin(final -from,len -to).
  16. Iffrom <to andto <from +count, then
    1. Letdirection be -1.
    2. Setfrom tofrom +count - 1.
    3. Setto toto +count - 1.
  17. Else,
    1. Letdirection be 1.
  18. Repeat, whilecount > 0,
    1. LetfromKey be ! ToString(𝔽(from)).
    2. LettoKey be ! ToString(𝔽(to)).
    3. LetfromPresent be ? HasProperty(O,fromKey).
    4. IffromPresent istrue, then
      1. LetfromValue be ? Get(O,fromKey).
      2. Perform ? Set(O,toKey,fromValue,true).
    5. Else,
      1. Assert:fromPresent isfalse.
      2. Perform ? DeletePropertyOrThrow(O,toKey).
    6. Setfrom tofrom +direction.
    7. Setto toto +direction.
    8. Setcount tocount - 1.
  19. ReturnO.
Note 3

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.5 Array.prototype.entries ( )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. ReturnCreateArrayIterator(O,key+value).

23.1.3.6 Array.prototype.every (callback [ ,thisArg ] )

Note 1

callback should be a function that accepts three arguments and returns a value that is coercible to a Boolean value.every callscallback once for each element present in the array, in ascending order, until it finds one wherecallback returnsfalse. If such an element is found,every immediately returnsfalse. Otherwise,every returnstrue.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.

If athisArg parameter is provided, it will be used as thethis value for each invocation ofcallback. If it is not provided,undefined is used instead.

callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.

every does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed byevery is set before the first call tocallback. Elements which are appended to the array after the call toevery begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timeevery visits them; elements that are deleted after the call toevery begins and before being visited are not visited.every acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returnstrue.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. Letk be 0.
  5. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. LettestResult beToBoolean(?Call(callback,thisArg, «kValue,𝔽(k),O »)).
      3. IftestResult isfalse, returnfalse.
    4. Setk tok + 1.
  6. Returntrue.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.7 Array.prototype.fill (value [ ,start [ ,end ] ] )

Note 1

Thestart argument is optional. If it is not provided,+0𝔽 is used.

Theend argument is optional. If it is not provided, the length of thethis value is used.

Note 2

Ifstart is negative, it is treated aslength +start wherelength is the length of the array. Ifend is negative, it is treated aslength +end.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeStart be ? ToIntegerOrInfinity(start).
  4. IfrelativeStart = -∞, letk be 0.
  5. Else ifrelativeStart < 0, letk bemax(len +relativeStart, 0).
  6. Else, letk bemin(relativeStart,len).
  7. Ifend isundefined, letrelativeEnd belen; else letrelativeEnd be ? ToIntegerOrInfinity(end).
  8. IfrelativeEnd = -∞, letfinal be 0.
  9. Else ifrelativeEnd < 0, letfinal bemax(len +relativeEnd, 0).
  10. Else, letfinal bemin(relativeEnd,len).
  11. Repeat, whilek <final,
    1. LetPk be ! ToString(𝔽(k)).
    2. Perform ? Set(O,Pk,value,true).
    3. Setk tok + 1.
  12. ReturnO.
Note 3

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.8 Array.prototype.filter (callback [ ,thisArg ] )

Note 1

callback should be a function that accepts three arguments and returns a value that is coercible to a Boolean value.filter callscallback once for each element in the array, in ascending order, and constructs a new array of all the values for whichcallback returnstrue.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.

If athisArg parameter is provided, it will be used as thethis value for each invocation ofcallback. If it is not provided,undefined is used instead.

callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.

filter does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed byfilter is set before the first call tocallback. Elements which are appended to the array after the call tofilter begins will not be visited bycallback. If existing elements of the array are changed their value as passed tocallback will be the value at the timefilter visits them; elements that are deleted after the call tofilter begins and before being visited are not visited.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. LetA be ? ArraySpeciesCreate(O, 0).
  5. Letk be 0.
  6. Letto be 0.
  7. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. Letselected beToBoolean(?Call(callback,thisArg, «kValue,𝔽(k),O »)).
      3. Ifselected istrue, then
        1. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(to)),kValue).
        2. Setto toto + 1.
    4. Setk tok + 1.
  8. ReturnA.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.9 Array.prototype.find (predicate [ ,thisArg ] )

Note 1

This method callspredicate once for each element of the array, in ascending index order, until it finds one wherepredicate returns a value that coerces totrue. If such an element is found,find immediately returns that element value. Otherwise,find returnsundefined.

SeeFindViaPredicate for additional information.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetfindRec be ? FindViaPredicate(O,len,ascending,predicate,thisArg).
  4. ReturnfindRec.[[Value]].
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.10 Array.prototype.findIndex (predicate [ ,thisArg ] )

Note 1

This method callspredicate once for each element of the array, in ascending index order, until it finds one wherepredicate returns a value that coerces totrue. If such an element is found,findIndex immediately returns the index of that element value. Otherwise,findIndex returns -1.

SeeFindViaPredicate for additional information.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetfindRec be ? FindViaPredicate(O,len,ascending,predicate,thisArg).
  4. ReturnfindRec.[[Index]].
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.11 Array.prototype.findLast (predicate [ ,thisArg ] )

Note 1

This method callspredicate once for each element of the array, in descending index order, until it finds one wherepredicate returns a value that coerces totrue. If such an element is found,findLast immediately returns that element value. Otherwise,findLast returnsundefined.

SeeFindViaPredicate for additional information.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetfindRec be ? FindViaPredicate(O,len,descending,predicate,thisArg).
  4. ReturnfindRec.[[Value]].
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.12 Array.prototype.findLastIndex (predicate [ ,thisArg ] )

Note 1

This method callspredicate once for each element of the array, in descending index order, until it finds one wherepredicate returns a value that coerces totrue. If such an element is found,findLastIndex immediately returns the index of that element value. Otherwise,findLastIndex returns -1.

SeeFindViaPredicate for additional information.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetfindRec be ? FindViaPredicate(O,len,descending,predicate,thisArg).
  4. ReturnfindRec.[[Index]].
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.12.1 FindViaPredicate (O,len,direction,predicate,thisArg )

The abstract operation FindViaPredicate takes argumentsO (an Object),len (a non-negativeinteger),direction (ascending ordescending),predicate (anECMAScript language value), andthisArg (anECMAScript language value) and returns either anormal completion containing aRecord with fields[[Index]] (anintegral Number) and[[Value]] (anECMAScript language value) or athrow completion.

O should be anarray-like object or aTypedArray. This operation callspredicate once for each element ofO, in either ascending index order or descending index order (as indicated bydirection), until it finds one wherepredicate returns a value that coerces totrue. At that point, this operation returns aRecord that gives the index and value of the element found. If no such element is found, this operation returns aRecord that specifies-1𝔽 for the index andundefined for the value.

predicate should be a function. When called for an element of the array, it is passed three arguments: the value of the element, the index of the element, and the object being traversed. Its return value will be coerced to a Boolean value.

thisArg will be used as thethis value for each invocation ofpredicate.

This operation does not directly mutate the object on which it is called, but the object may be mutated by the calls topredicate.

The range of elements processed is set before the first call topredicate, just before the traversal begins. Elements that are appended to the array after this will not be visited bypredicate. If existing elements of the array are changed, their value as passed topredicate will be the value at the time that this operation visits them. Elements that are deleted after traversal begins and before being visited are still visited and are either looked up from the prototype or areundefined.

It performs the following steps when called:

  1. IfIsCallable(predicate) isfalse, throw aTypeError exception.
  2. Ifdirection isascending, then
    1. Letindices be aList of theintegers in theinterval from 0 (inclusive) tolen (exclusive), in ascending order.
  3. Else,
    1. Letindices be aList of theintegers in theinterval from 0 (inclusive) tolen (exclusive), in descending order.
  4. For eachintegerk ofindices, do
    1. LetPk be ! ToString(𝔽(k)).
    2. NOTE: IfO is aTypedArray, the following invocation ofGet will return anormal completion.
    3. LetkValue be ? Get(O,Pk).
    4. LettestResult be ? Call(predicate,thisArg, «kValue,𝔽(k),O »).
    5. IfToBoolean(testResult) istrue, return theRecord {[[Index]]:𝔽(k),[[Value]]:kValue }.
  5. Return theRecord {[[Index]]:-1𝔽,[[Value]]:undefined }.

23.1.3.13 Array.prototype.flat ( [depth ] )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. LetsourceLen be ? LengthOfArrayLike(O).
  3. LetdepthNum be 1.
  4. Ifdepth is notundefined, then
    1. SetdepthNum to ? ToIntegerOrInfinity(depth).
    2. IfdepthNum < 0, setdepthNum to 0.
  5. LetA be ? ArraySpeciesCreate(O, 0).
  6. Perform ? FlattenIntoArray(A,O,sourceLen, 0,depthNum).
  7. ReturnA.

23.1.3.13.1 FlattenIntoArray (target,source,sourceLen,start,depth [ ,mapperFunction [ ,thisArg ] ] )

The abstract operation FlattenIntoArray takes argumentstarget (an Object),source (an Object),sourceLen (a non-negativeinteger),start (a non-negativeinteger), anddepth (a non-negativeinteger or +∞) and optional argumentsmapperFunction (afunction object) andthisArg (anECMAScript language value) and returns either anormal completion containing a non-negativeinteger or athrow completion. It performs the following steps when called:

  1. Assert: IfmapperFunction is present, thenIsCallable(mapperFunction) istrue,thisArg is present, anddepth is 1.
  2. LettargetIndex bestart.
  3. LetsourceIndex be+0𝔽.
  4. Repeat, while(sourceIndex) <sourceLen,
    1. LetP be ! ToString(sourceIndex).
    2. Letexists be ? HasProperty(source,P).
    3. Ifexists istrue, then
      1. Letelement be ? Get(source,P).
      2. IfmapperFunction is present, then
        1. Setelement to ? Call(mapperFunction,thisArg, «element,sourceIndex,source »).
      3. LetshouldFlatten befalse.
      4. Ifdepth > 0, then
        1. SetshouldFlatten to ? IsArray(element).
      5. IfshouldFlatten istrue, then
        1. Ifdepth = +∞, letnewDepth be +∞.
        2. Else, letnewDepth bedepth - 1.
        3. LetelementLen be ? LengthOfArrayLike(element).
        4. SettargetIndex to ? FlattenIntoArray(target,element,elementLen,targetIndex,newDepth).
      6. Else,
        1. IftargetIndex ≥ 253 - 1, throw aTypeError exception.
        2. Perform ? CreateDataPropertyOrThrow(target, ! ToString(𝔽(targetIndex)),element).
        3. SettargetIndex totargetIndex + 1.
    4. SetsourceIndex tosourceIndex +1𝔽.
  5. ReturntargetIndex.

23.1.3.14 Array.prototype.flatMap (mapperFunction [ ,thisArg ] )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. LetsourceLen be ? LengthOfArrayLike(O).
  3. IfIsCallable(mapperFunction) isfalse, throw aTypeError exception.
  4. LetA be ? ArraySpeciesCreate(O, 0).
  5. Perform ? FlattenIntoArray(A,O,sourceLen, 0, 1,mapperFunction,thisArg).
  6. ReturnA.

23.1.3.15 Array.prototype.forEach (callback [ ,thisArg ] )

Note 1

callback should be a function that accepts three arguments.forEach callscallback once for each element present in the array, in ascending order.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.

If athisArg parameter is provided, it will be used as thethis value for each invocation ofcallback. If it is not provided,undefined is used instead.

callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.

forEach does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed byforEach is set before the first call tocallback. Elements which are appended to the array after the call toforEach begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timeforEach visits them; elements that are deleted after the call toforEach begins and before being visited are not visited.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. Letk be 0.
  5. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. Perform ? Call(callback,thisArg, «kValue,𝔽(k),O »).
    4. Setk tok + 1.
  6. Returnundefined.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.16 Array.prototype.includes (searchElement [ ,fromIndex ] )

Note 1

This method comparessearchElement to the elements of the array, in ascending order, using theSameValueZero algorithm, and if found at any position, returnstrue; otherwise, it returnsfalse.

The optional second argumentfromIndex defaults to+0𝔽 (i.e. the whole array is searched). If it is greater than or equal to the length of the array,false is returned, i.e. the array will not be searched. If it is less than-0𝔽, it is used as the offset from the end of the array to computefromIndex. If the computed index is less than or equal to+0𝔽, the whole array will be searched.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Iflen = 0, returnfalse.
  4. Letn be ? ToIntegerOrInfinity(fromIndex).
  5. Assert: IffromIndex isundefined, thenn is 0.
  6. Ifn = +∞, returnfalse.
  7. Else ifn = -∞, setn to 0.
  8. Ifn ≥ 0, then
    1. Letk ben.
  9. Else,
    1. Letk belen +n.
    2. Ifk < 0, setk to 0.
  10. Repeat, whilek <len,
    1. LetelementK be ? Get(O, ! ToString(𝔽(k))).
    2. IfSameValueZero(searchElement,elementK) istrue, returntrue.
    3. Setk tok + 1.
  11. Returnfalse.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

Note 3

This method intentionally differs from the similarindexOf method in two ways. First, it uses theSameValueZero algorithm, instead ofIsStrictlyEqual, allowing it to detectNaN array elements. Second, it does not skip missing array elements, instead treating them asundefined.

23.1.3.17 Array.prototype.indexOf (searchElement [ ,fromIndex ] )

This method comparessearchElement to the elements of the array, in ascending order, using theIsStrictlyEqual algorithm, and if found at one or more indices, returns the smallest such index; otherwise, it returns-1𝔽.

Note 1

The optional second argumentfromIndex defaults to+0𝔽 (i.e. the whole array is searched). If it is greater than or equal to the length of the array,-1𝔽 is returned, i.e. the array will not be searched. If it is less than-0𝔽, it is used as the offset from the end of the array to computefromIndex. If the computed index is less than or equal to+0𝔽, the whole array will be searched.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Iflen = 0, return-1𝔽.
  4. Letn be ? ToIntegerOrInfinity(fromIndex).
  5. Assert: IffromIndex isundefined, thenn is 0.
  6. Ifn = +∞, return-1𝔽.
  7. Else ifn = -∞, setn to 0.
  8. Ifn ≥ 0, then
    1. Letk ben.
  9. Else,
    1. Letk belen +n.
    2. Ifk < 0, setk to 0.
  10. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetelementK be ? Get(O,Pk).
      2. IfIsStrictlyEqual(searchElement,elementK) istrue, return𝔽(k).
    4. Setk tok + 1.
  11. Return-1𝔽.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.18 Array.prototype.join (separator )

This method converts the elements of the array to Strings, and then concatenates these Strings, separated by occurrences of theseparator. If no separator is provided, a single comma is used as the separator.

It performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Ifseparator isundefined, letsep be",".
  4. Else, letsep be ? ToString(separator).
  5. LetR be the empty String.
  6. Letk be 0.
  7. Repeat, whilek <len,
    1. Ifk > 0, setR to thestring-concatenation ofR andsep.
    2. Letelement be ? Get(O, ! ToString(𝔽(k))).
    3. Ifelement is neitherundefined nornull, then
      1. LetS be ? ToString(element).
      2. SetR to thestring-concatenation ofR andS.
    4. Setk tok + 1.
  8. ReturnR.
Note

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore, it can be transferred to other kinds of objects for use as a method.

23.1.3.19 Array.prototype.keys ( )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. ReturnCreateArrayIterator(O,key).

23.1.3.20 Array.prototype.lastIndexOf (searchElement [ ,fromIndex ] )

Note 1

This method comparessearchElement to the elements of the array in descending order using theIsStrictlyEqual algorithm, and if found at one or more indices, returns the largest such index; otherwise, it returns-1𝔽.

The optional second argumentfromIndex defaults to the array's length minus one (i.e. the whole array is searched). If it is greater than or equal to the length of the array, the whole array will be searched. If it is less than-0𝔽, it is used as the offset from the end of the array to computefromIndex. If the computed index is less than or equal to+0𝔽,-1𝔽 is returned.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Iflen = 0, return-1𝔽.
  4. IffromIndex is present, letn be ? ToIntegerOrInfinity(fromIndex); else letn belen - 1.
  5. Ifn = -∞, return-1𝔽.
  6. Ifn ≥ 0, then
    1. Letk bemin(n,len - 1).
  7. Else,
    1. Letk belen +n.
  8. Repeat, whilek ≥ 0,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetelementK be ? Get(O,Pk).
      2. IfIsStrictlyEqual(searchElement,elementK) istrue, return𝔽(k).
    4. Setk tok - 1.
  9. Return-1𝔽.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.21 Array.prototype.map (callback [ ,thisArg ] )

Note 1

callback should be a function that accepts three arguments.map callscallback once for each element in the array, in ascending order, and constructs a new Array from the results.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.

If athisArg parameter is provided, it will be used as thethis value for each invocation ofcallback. If it is not provided,undefined is used instead.

callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.

map does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed bymap is set before the first call tocallback. Elements which are appended to the array after the call tomap begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timemap visits them; elements that are deleted after the call tomap begins and before being visited are not visited.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. LetA be ? ArraySpeciesCreate(O,len).
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. LetmappedValue be ? Call(callback,thisArg, «kValue,𝔽(k),O »).
      3. Perform ? CreateDataPropertyOrThrow(A,Pk,mappedValue).
    4. Setk tok + 1.
  7. ReturnA.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.22 Array.prototype.pop ( )

Note 1

This method removes the last element of the array and returns it.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Iflen = 0, then
    1. Perform ? Set(O,"length",+0𝔽,true).
    2. Returnundefined.
  4. Else,
    1. Assert:len > 0.
    2. LetnewLen be𝔽(len - 1).
    3. Letindex be ! ToString(newLen).
    4. Letelement be ? Get(O,index).
    5. Perform ? DeletePropertyOrThrow(O,index).
    6. Perform ? Set(O,"length",newLen,true).
    7. Returnelement.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.23 Array.prototype.push ( ...items )

Note 1

This method appends the arguments to the end of the array, in the order in which they appear. It returns the new length of the array.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetargCount be the number of elements initems.
  4. Iflen +argCount > 253 - 1, throw aTypeError exception.
  5. For each elementE ofitems, do
    1. Perform ? Set(O, ! ToString(𝔽(len)),E,true).
    2. Setlen tolen + 1.
  6. Perform ? Set(O,"length",𝔽(len),true).
  7. Return𝔽(len).

The"length" property of this method is1𝔽.

Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.24 Array.prototype.reduce (callback [ ,initialValue ] )

Note 1

callback should be a function that takes four arguments.reduce calls the callback, as a function, once for each element after the first element present in the array, in ascending order.

callback is called with four arguments: thepreviousValue (value from the previous call tocallback), thecurrentValue (value of the current element), thecurrentIndex, and the object being traversed. The first time that callback is called, thepreviousValue andcurrentValue can be one of two values. If aninitialValue was supplied in the call toreduce, thenpreviousValue will beinitialValue andcurrentValue will be the first value in the array. If noinitialValue was supplied, thenpreviousValue will be the first value in the array andcurrentValue will be the second. It is aTypeError if the array contains no elements andinitialValue is not provided.

reduce does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed byreduce is set before the first call tocallback. Elements that are appended to the array after the call toreduce begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the timereduce visits them; elements that are deleted after the call toreduce begins and before being visited are not visited.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. Iflen = 0 andinitialValue is not present, throw aTypeError exception.
  5. Letk be 0.
  6. Letaccumulator beundefined.
  7. IfinitialValue is present, then
    1. Setaccumulator toinitialValue.
  8. Else,
    1. LetkPresent befalse.
    2. Repeat, whilekPresent isfalse andk <len,
      1. LetPk be ! ToString(𝔽(k)).
      2. SetkPresent to ? HasProperty(O,Pk).
      3. IfkPresent istrue, then
        1. Setaccumulator to ? Get(O,Pk).
      4. Setk tok + 1.
    3. IfkPresent isfalse, throw aTypeError exception.
  9. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. Setaccumulator to ? Call(callback,undefined, «accumulator,kValue,𝔽(k),O »).
    4. Setk tok + 1.
  10. Returnaccumulator.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.25 Array.prototype.reduceRight (callback [ ,initialValue ] )

Note 1

callback should be a function that takes four arguments.reduceRight calls the callback, as a function, once for each element after the first element present in the array, in descending order.

callback is called with four arguments: thepreviousValue (value from the previous call tocallback), thecurrentValue (value of the current element), thecurrentIndex, and the object being traversed. The first time the function is called, thepreviousValue andcurrentValue can be one of two values. If aninitialValue was supplied in the call toreduceRight, thenpreviousValue will beinitialValue andcurrentValue will be the last value in the array. If noinitialValue was supplied, thenpreviousValue will be the last value in the array andcurrentValue will be the second-to-last value. It is aTypeError if the array contains no elements andinitialValue is not provided.

reduceRight does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed byreduceRight is set before the first call tocallback. Elements that are appended to the array after the call toreduceRight begins will not be visited bycallback. If existing elements of the array are changed bycallback, their value as passed tocallback will be the value at the timereduceRight visits them; elements that are deleted after the call toreduceRight begins and before being visited are not visited.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. Iflen = 0 andinitialValue is not present, throw aTypeError exception.
  5. Letk belen - 1.
  6. Letaccumulator beundefined.
  7. IfinitialValue is present, then
    1. Setaccumulator toinitialValue.
  8. Else,
    1. LetkPresent befalse.
    2. Repeat, whilekPresent isfalse andk ≥ 0,
      1. LetPk be ! ToString(𝔽(k)).
      2. SetkPresent to ? HasProperty(O,Pk).
      3. IfkPresent istrue, then
        1. Setaccumulator to ? Get(O,Pk).
      4. Setk tok - 1.
    3. IfkPresent isfalse, throw aTypeError exception.
  9. Repeat, whilek ≥ 0,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. Setaccumulator to ? Call(callback,undefined, «accumulator,kValue,𝔽(k),O »).
    4. Setk tok - 1.
  10. Returnaccumulator.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.26 Array.prototype.reverse ( )

Note 1

This method rearranges the elements of the array so as to reverse their order. It returns the reversed array.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Letmiddle befloor(len / 2).
  4. Letlower be 0.
  5. Repeat, whilelowermiddle,
    1. Letupper belen -lower - 1.
    2. LetupperP be ! ToString(𝔽(upper)).
    3. LetlowerP be ! ToString(𝔽(lower)).
    4. LetlowerExists be ? HasProperty(O,lowerP).
    5. IflowerExists istrue, then
      1. LetlowerValue be ? Get(O,lowerP).
    6. LetupperExists be ? HasProperty(O,upperP).
    7. IfupperExists istrue, then
      1. LetupperValue be ? Get(O,upperP).
    8. IflowerExists istrue andupperExists istrue, then
      1. Perform ? Set(O,lowerP,upperValue,true).
      2. Perform ? Set(O,upperP,lowerValue,true).
    9. Else iflowerExists isfalse andupperExists istrue, then
      1. Perform ? Set(O,lowerP,upperValue,true).
      2. Perform ? DeletePropertyOrThrow(O,upperP).
    10. Else iflowerExists istrue andupperExists isfalse, then
      1. Perform ? DeletePropertyOrThrow(O,lowerP).
      2. Perform ? Set(O,upperP,lowerValue,true).
    11. Else,
      1. Assert:lowerExists andupperExists are bothfalse.
      2. NOTE: No action is required.
    12. Setlower tolower + 1.
  6. ReturnO.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore, it can be transferred to other kinds of objects for use as a method.

23.1.3.27 Array.prototype.shift ( )

This method removes the first element of the array and returns it.

It performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. Iflen = 0, then
    1. Perform ? Set(O,"length",+0𝔽,true).
    2. Returnundefined.
  4. Letfirst be ? Get(O,"0").
  5. Letk be 1.
  6. Repeat, whilek <len,
    1. Letfrom be ! ToString(𝔽(k)).
    2. Letto be ! ToString(𝔽(k - 1)).
    3. LetfromPresent be ? HasProperty(O,from).
    4. IffromPresent istrue, then
      1. LetfromValue be ? Get(O,from).
      2. Perform ? Set(O,to,fromValue,true).
    5. Else,
      1. Assert:fromPresent isfalse.
      2. Perform ? DeletePropertyOrThrow(O,to).
    6. Setk tok + 1.
  7. Perform ? DeletePropertyOrThrow(O, ! ToString(𝔽(len - 1))).
  8. Perform ? Set(O,"length",𝔽(len - 1),true).
  9. Returnfirst.
Note

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.28 Array.prototype.slice (start,end )

This method returns an array containing the elements of the array from elementstart up to, but not including, elementend (or through the end of the array ifend isundefined). Ifstart is negative, it is treated aslength +start wherelength is the length of the array. Ifend is negative, it is treated aslength +end wherelength is the length of the array.

It performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeStart be ? ToIntegerOrInfinity(start).
  4. IfrelativeStart = -∞, letk be 0.
  5. Else ifrelativeStart < 0, letk bemax(len +relativeStart, 0).
  6. Else, letk bemin(relativeStart,len).
  7. Ifend isundefined, letrelativeEnd belen; else letrelativeEnd be ? ToIntegerOrInfinity(end).
  8. IfrelativeEnd = -∞, letfinal be 0.
  9. Else ifrelativeEnd < 0, letfinal bemax(len +relativeEnd, 0).
  10. Else, letfinal bemin(relativeEnd,len).
  11. Letcount bemax(final -k, 0).
  12. LetA be ? ArraySpeciesCreate(O,count).
  13. Letn be 0.
  14. Repeat, whilek <final,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)),kValue).
    4. Setk tok + 1.
    5. Setn ton + 1.
  15. Perform ? Set(A,"length",𝔽(n),true).
  16. ReturnA.
Note 1

The explicit setting of the"length" property in step15 is intended to ensure the length is correct even whenA is not a built-in Array.

Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.29 Array.prototype.some (callback [ ,thisArg ] )

Note 1

callback should be a function that accepts three arguments and returns a value that is coercible to a Boolean value.some callscallback once for each element present in the array, in ascending order, until it finds one wherecallback returnstrue. If such an element is found,some immediately returnstrue. Otherwise,some returnsfalse.callback is called only for elements of the array which actually exist; it is not called for missing elements of the array.

If athisArg parameter is provided, it will be used as thethis value for each invocation ofcallback. If it is not provided,undefined is used instead.

callback is called with three arguments: the value of the element, the index of the element, and the object being traversed.

some does not directly mutate the object on which it is called but the object may be mutated by the calls tocallback.

The range of elements processed bysome is set before the first call tocallback. Elements that are appended to the array after the call tosome begins will not be visited bycallback. If existing elements of the array are changed, their value as passed tocallback will be the value at the time thatsome visits them; elements that are deleted after the call tosome begins and before being visited are not visited.some acts like the "exists" quantifier in mathematics. In particular, for an empty array, it returnsfalse.

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. IfIsCallable(callback) isfalse, throw aTypeError exception.
  4. Letk be 0.
  5. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ? HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetkValue be ? Get(O,Pk).
      2. LettestResult beToBoolean(?Call(callback,thisArg, «kValue,𝔽(k),O »)).
      3. IftestResult istrue, returntrue.
    4. Setk tok + 1.
  6. Returnfalse.
Note 2

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.30 Array.prototype.sort (comparator )

This method sorts the elements of this array. Ifcomparator is notundefined, it should be a function that accepts two argumentsx andy and returns a negative Number ifx <y, a positive Number ifx >y, or a zero otherwise.

It performs the following steps when called:

  1. Ifcomparator is notundefined andIsCallable(comparator) isfalse, throw aTypeError exception.
  2. Letobj be ? ToObject(this value).
  3. Letlen be ? LengthOfArrayLike(obj).
  4. LetSortCompare be a newAbstract Closure with parameters (x,y) that capturescomparator and performs the following steps when called:
    1. Return ? CompareArrayElements(x,y,comparator).
  5. LetsortedList be ? SortIndexedProperties(obj,len,SortCompare,skip-holes).
  6. LetitemCount be the number of elements insortedList.
  7. Letj be 0.
  8. Repeat, whilej <itemCount,
    1. Perform ? Set(obj, ! ToString(𝔽(j)),sortedList[j],true).
    2. Setj toj + 1.
  9. NOTE: The call toSortIndexedProperties in step5 usesskip-holes. The remaining indices are deleted to preserve the number of holes that were detected and excluded from the sort.
  10. Repeat, whilej <len,
    1. Perform ? DeletePropertyOrThrow(obj, ! ToString(𝔽(j))).
    2. Setj toj + 1.
  11. Returnobj.
Note 1

Because non-existent property values always compare greater thanundefined property values, andundefined always compares greater than any other value (seeCompareArrayElements),undefined property values always sort to the end of the result, followed by non-existent property values.

Note 2

Method calls performed by theToStringabstract operations in steps5 and6 have the potential to causeSortCompare to not behave as aconsistent comparator.

Note 3

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore, it can be transferred to other kinds of objects for use as a method.

23.1.3.30.1 SortIndexedProperties (obj,len,SortCompare,holes )

The abstract operation SortIndexedProperties takes argumentsobj (an Object),len (a non-negativeinteger),SortCompare (anAbstract Closure with two parameters), andholes (skip-holes orread-through-holes) and returns either anormal completion containing aList ofECMAScript language values or athrow completion. It performs the following steps when called:

  1. Letitems be a new emptyList.
  2. Letk be 0.
  3. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. Ifholes isskip-holes, then
      1. LetkRead be ? HasProperty(obj,Pk).
    3. Else,
      1. Assert:holes isread-through-holes.
      2. LetkRead betrue.
    4. IfkRead istrue, then
      1. LetkValue be ? Get(obj,Pk).
      2. AppendkValue toitems.
    5. Setk tok + 1.
  4. Sortitems using animplementation-defined sequence ofcalls toSortCompare. If any such call returns anabrupt completion, stop before performing any further calls toSortCompare and return thatCompletion Record.
  5. Returnitems.

Thesort order is the ordering ofitems after completion of step4 of the algorithm above. Thesort order isimplementation-defined ifSortCompare is not aconsistent comparator for the elements ofitems. When SortIndexedProperties is invoked byArray.prototype.sort orArray.prototype.toSorted, thesort order is alsoimplementation-defined ifcomparator isundefined, and all applications ofToString, to any specific value passed as an argument toSortCompare, do not produce the same result.

Unless thesort order is specified to beimplementation-defined, it must satisfy all of the following conditions:

  • There must be some mathematical permutation π of the non-negativeintegers less thanitemCount, such that for every non-negativeintegerj less thanitemCount, the elementold[j] is exactly the same asnew[π(j)].
  • Then for all non-negativeintegersj andk, each less thanitemCount, if(SortCompare(old[j], old[k])) < 0, thenπ(j) < π(k).
  • And for all non-negativeintegersj andk such thatj <k <itemCount, if(SortCompare(old[j], old[k])) = 0, thenπ(j) < π(k); i.e., the sort is stable.

Here the notationold[j] is used to refer toitems[j] before step4 is executed, and the notationnew[j] to refer toitems[j] after step4 has been executed.

An abstract closure or functioncomparator is aconsistent comparator for a set of valuesS if all of the requirements below are met for all valuesa,b, andc (possibly the same value) in the setS: The notationa <Cb means(comparator(a,b)) < 0;a =Cb means(comparator(a,b)) = 0; anda >Cb means(comparator(a,b)) > 0.

  • Callingcomparator(a,b) always returns the same valuev when given a specific pair of valuesa andb as its two arguments. Furthermore,vis a Number, andv is notNaN. Note that this implies that exactly one ofa <Cb,a =Cb, anda >Cb will be true for a given pair ofa andb.
  • Callingcomparator(a,b) does not modifyobj or any object onobj's prototype chain.
  • a =Ca (reflexivity)
  • Ifa =Cb, thenb =Ca (symmetry)
  • Ifa =Cb andb =Cc, thena =Cc (transitivity of =C)
  • Ifa <Cb andb <Cc, thena <Cc (transitivity of <C)
  • Ifa >Cb andb >Cc, thena >Cc (transitivity of >C)
Note

The above conditions are necessary and sufficient to ensure thatcomparator divides the setS into equivalence classes and that these equivalence classes are totally ordered.

23.1.3.30.2 CompareArrayElements (x,y,comparator )

The abstract operation CompareArrayElements takes argumentsx (anECMAScript language value),y (anECMAScript language value), andcomparator (afunction object orundefined) and returns either anormal completion containing a Number or anabrupt completion. It performs the following steps when called:

  1. Ifx andy are bothundefined, return+0𝔽.
  2. Ifx isundefined, return1𝔽.
  3. Ify isundefined, return-1𝔽.
  4. Ifcomparator is notundefined, then
    1. Letv be ? ToNumber(?Call(comparator,undefined, «x,y »)).
    2. Ifv isNaN, return+0𝔽.
    3. Returnv.
  5. LetxString be ? ToString(x).
  6. LetyString be ? ToString(y).
  7. LetxSmaller be ! IsLessThan(xString,yString,true).
  8. IfxSmaller istrue, return-1𝔽.
  9. LetySmaller be ! IsLessThan(yString,xString,true).
  10. IfySmaller istrue, return1𝔽.
  11. Return+0𝔽.

23.1.3.31 Array.prototype.splice (start,deleteCount, ...items )

Note 1

This method deletes thedeleteCount elements of the array starting atinteger indexstart and replaces them with the elements ofitems. It returns an Array containing the deleted elements (if any).

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeStart be ? ToIntegerOrInfinity(start).
  4. IfrelativeStart = -∞, letactualStart be 0.
  5. Else ifrelativeStart < 0, letactualStart bemax(len +relativeStart, 0).
  6. Else, letactualStart bemin(relativeStart,len).
  7. LetitemCount be the number of elements initems.
  8. Ifstart is not present, then
    1. LetactualDeleteCount be 0.
  9. Else ifdeleteCount is not present, then
    1. LetactualDeleteCount belen -actualStart.
  10. Else,
    1. Letdc be ? ToIntegerOrInfinity(deleteCount).
    2. LetactualDeleteCount be the result ofclampingdc between 0 andlen -actualStart.
  11. Iflen +itemCount -actualDeleteCount > 253 - 1, throw aTypeError exception.
  12. LetA be ? ArraySpeciesCreate(O,actualDeleteCount).
  13. Letk be 0.
  14. Repeat, whilek <actualDeleteCount,
    1. Letfrom be ! ToString(𝔽(actualStart +k)).
    2. If ? HasProperty(O,from) istrue, then
      1. LetfromValue be ? Get(O,from).
      2. Perform ? CreateDataPropertyOrThrow(A, ! ToString(𝔽(k)),fromValue).
    3. Setk tok + 1.
  15. Perform ? Set(A,"length",𝔽(actualDeleteCount),true).
  16. IfitemCount <actualDeleteCount, then
    1. Setk toactualStart.
    2. Repeat, whilek < (len -actualDeleteCount),
      1. Letfrom be ! ToString(𝔽(k +actualDeleteCount)).
      2. Letto be ! ToString(𝔽(k +itemCount)).
      3. If ? HasProperty(O,from) istrue, then
        1. LetfromValue be ? Get(O,from).
        2. Perform ? Set(O,to,fromValue,true).
      4. Else,
        1. Perform ? DeletePropertyOrThrow(O,to).
      5. Setk tok + 1.
    3. Setk tolen.
    4. Repeat, whilek > (len -actualDeleteCount +itemCount),
      1. Perform ? DeletePropertyOrThrow(O, ! ToString(𝔽(k - 1))).
      2. Setk tok - 1.
  17. Else ifitemCount >actualDeleteCount, then
    1. Setk to (len -actualDeleteCount).
    2. Repeat, whilek >actualStart,
      1. Letfrom be ! ToString(𝔽(k +actualDeleteCount - 1)).
      2. Letto be ! ToString(𝔽(k +itemCount - 1)).
      3. If ? HasProperty(O,from) istrue, then
        1. LetfromValue be ? Get(O,from).
        2. Perform ? Set(O,to,fromValue,true).
      4. Else,
        1. Perform ? DeletePropertyOrThrow(O,to).
      5. Setk tok - 1.
  18. Setk toactualStart.
  19. For each elementE ofitems, do
    1. Perform ? Set(O, ! ToString(𝔽(k)),E,true).
    2. Setk tok + 1.
  20. Perform ? Set(O,"length",𝔽(len -actualDeleteCount +itemCount),true).
  21. ReturnA.
Note 2

The explicit setting of the"length" property in steps15 and20 is intended to ensure the lengths are correct even when the objects are not built-in Arrays.

Note 3

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.32 Array.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )

An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used.

Note 1

The first edition of ECMA-402 did not include a replacement specification for this method.

The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.

This method performs the following steps when called:

  1. Letarray be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(array).
  3. Letseparator be theimplementation-defined list-separator String value appropriate for thehost environment's current locale (such as", ").
  4. LetR be the empty String.
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. Ifk > 0, setR to thestring-concatenation ofR andseparator.
    2. Letelement be ? Get(array, ! ToString(𝔽(k))).
    3. Ifelement is neitherundefined nornull, then
      1. LetS be ? ToString(?Invoke(element,"toLocaleString")).
      2. SetR to thestring-concatenation ofR andS.
    4. Setk tok + 1.
  7. ReturnR.
Note 2

This method converts the elements of the array to Strings using theirtoLocaleString methods, and then concatenates these Strings, separated by occurrences of animplementation-defined locale-sensitive separator String. This method is analogous totoString except that it is intended to yield a locale-sensitive result corresponding with conventions of thehost environment's current locale.

Note 3

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.33 Array.prototype.toReversed ( )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetA be ? ArrayCreate(len).
  4. Letk be 0.
  5. Repeat, whilek <len,
    1. Letfrom be ! ToString(𝔽(len -k - 1)).
    2. LetPk be ! ToString(𝔽(k)).
    3. LetfromValue be ? Get(O,from).
    4. Perform ! CreateDataPropertyOrThrow(A,Pk,fromValue).
    5. Setk tok + 1.
  6. ReturnA.

23.1.3.34 Array.prototype.toSorted (comparator )

This method performs the following steps when called:

  1. Ifcomparator is notundefined andIsCallable(comparator) isfalse, throw aTypeError exception.
  2. LetO be ? ToObject(this value).
  3. Letlen be ? LengthOfArrayLike(O).
  4. LetA be ? ArrayCreate(len).
  5. LetSortCompare be a newAbstract Closure with parameters (x,y) that capturescomparator and performs the following steps when called:
    1. Return ? CompareArrayElements(x,y,comparator).
  6. LetsortedList be ? SortIndexedProperties(O,len,SortCompare,read-through-holes).
  7. Letj be 0.
  8. Repeat, whilej <len,
    1. Perform ! CreateDataPropertyOrThrow(A, ! ToString(𝔽(j)),sortedList[j]).
    2. Setj toj + 1.
  9. ReturnA.

23.1.3.35 Array.prototype.toSpliced (start,skipCount, ...items )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeStart be ? ToIntegerOrInfinity(start).
  4. IfrelativeStart = -∞, letactualStart be 0.
  5. Else ifrelativeStart < 0, letactualStart bemax(len +relativeStart, 0).
  6. Else, letactualStart bemin(relativeStart,len).
  7. LetinsertCount be the number of elements initems.
  8. Ifstart is not present, then
    1. LetactualSkipCount be 0.
  9. Else ifskipCount is not present, then
    1. LetactualSkipCount belen -actualStart.
  10. Else,
    1. Letsc be ? ToIntegerOrInfinity(skipCount).
    2. LetactualSkipCount be the result ofclampingsc between 0 andlen -actualStart.
  11. LetnewLen belen +insertCount -actualSkipCount.
  12. IfnewLen > 253 - 1, throw aTypeError exception.
  13. LetA be ? ArrayCreate(newLen).
  14. Leti be 0.
  15. Letr beactualStart +actualSkipCount.
  16. Repeat, whilei <actualStart,
    1. LetPi be ! ToString(𝔽(i)).
    2. LetiValue be ? Get(O,Pi).
    3. Perform ! CreateDataPropertyOrThrow(A,Pi,iValue).
    4. Seti toi + 1.
  17. For each elementE ofitems, do
    1. LetPi be ! ToString(𝔽(i)).
    2. Perform ! CreateDataPropertyOrThrow(A,Pi,E).
    3. Seti toi + 1.
  18. Repeat, whilei <newLen,
    1. LetPi be ! ToString(𝔽(i)).
    2. Letfrom be ! ToString(𝔽(r)).
    3. LetfromValue be ? Get(O,from).
    4. Perform ! CreateDataPropertyOrThrow(A,Pi,fromValue).
    5. Seti toi + 1.
    6. Setr tor + 1.
  19. ReturnA.

23.1.3.36 Array.prototype.toString ( )

This method performs the following steps when called:

  1. Letarray be ? ToObject(this value).
  2. Letfunc be ? Get(array,"join").
  3. IfIsCallable(func) isfalse, setfunc to the intrinsic function %Object.prototype.toString%.
  4. Return ? Call(func,array).
Note

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.37 Array.prototype.unshift ( ...items )

This method prepends the arguments to the start of the array, such that their order within the array is the same as the order in which they appear in the argument list.

It performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetargCount be the number of elements initems.
  4. IfargCount > 0, then
    1. Iflen +argCount > 253 - 1, throw aTypeError exception.
    2. Letk belen.
    3. Repeat, whilek > 0,
      1. Letfrom be ! ToString(𝔽(k - 1)).
      2. Letto be ! ToString(𝔽(k +argCount - 1)).
      3. LetfromPresent be ? HasProperty(O,from).
      4. IffromPresent istrue, then
        1. LetfromValue be ? Get(O,from).
        2. Perform ? Set(O,to,fromValue,true).
      5. Else,
        1. Assert:fromPresent isfalse.
        2. Perform ? DeletePropertyOrThrow(O,to).
      6. Setk tok - 1.
    4. Letj be+0𝔽.
    5. For each elementE ofitems, do
      1. Perform ? Set(O, ! ToString(j),E,true).
      2. Setj toj +1𝔽.
  5. Perform ? Set(O,"length",𝔽(len +argCount),true).
  6. Return𝔽(len +argCount).

The"length" property of this method is1𝔽.

Note

This method is intentionally generic; it does not require that itsthis value be an Array. Therefore it can be transferred to other kinds of objects for use as a method.

23.1.3.38 Array.prototype.values ( )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. ReturnCreateArrayIterator(O,value).

23.1.3.39 Array.prototype.with (index,value )

This method performs the following steps when called:

  1. LetO be ? ToObject(this value).
  2. Letlen be ? LengthOfArrayLike(O).
  3. LetrelativeIndex be ? ToIntegerOrInfinity(index).
  4. IfrelativeIndex ≥ 0, letactualIndex berelativeIndex.
  5. Else, letactualIndex belen +relativeIndex.
  6. IfactualIndexlen oractualIndex < 0, throw aRangeError exception.
  7. LetA be ? ArrayCreate(len).
  8. Letk be 0.
  9. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. Ifk =actualIndex, letfromValue bevalue.
    3. Else, letfromValue be ? Get(O,Pk).
    4. Perform ! CreateDataPropertyOrThrow(A,Pk,fromValue).
    5. Setk tok + 1.
  10. ReturnA.

23.1.3.40 Array.prototype [ %Symbol.iterator% ] ( )

The initial value of the%Symbol.iterator% property is %Array.prototype.values%, defined in23.1.3.38.

23.1.3.41 Array.prototype [ %Symbol.unscopables% ]

The initial value of the%Symbol.unscopables%data property is an object created by the following steps:

  1. LetunscopableList beOrdinaryObjectCreate(null).
  2. Perform ! CreateDataPropertyOrThrow(unscopableList,"at",true).
  3. Perform ! CreateDataPropertyOrThrow(unscopableList,"copyWithin",true).
  4. Perform ! CreateDataPropertyOrThrow(unscopableList,"entries",true).
  5. Perform ! CreateDataPropertyOrThrow(unscopableList,"fill",true).
  6. Perform ! CreateDataPropertyOrThrow(unscopableList,"find",true).
  7. Perform ! CreateDataPropertyOrThrow(unscopableList,"findIndex",true).
  8. Perform ! CreateDataPropertyOrThrow(unscopableList,"findLast",true).
  9. Perform ! CreateDataPropertyOrThrow(unscopableList,"findLastIndex",true).
  10. Perform ! CreateDataPropertyOrThrow(unscopableList,"flat",true).
  11. Perform ! CreateDataPropertyOrThrow(unscopableList,"flatMap",true).
  12. Perform ! CreateDataPropertyOrThrow(unscopableList,"includes",true).
  13. Perform ! CreateDataPropertyOrThrow(unscopableList,"keys",true).
  14. Perform ! CreateDataPropertyOrThrow(unscopableList,"toReversed",true).
  15. Perform ! CreateDataPropertyOrThrow(unscopableList,"toSorted",true).
  16. Perform ! CreateDataPropertyOrThrow(unscopableList,"toSpliced",true).
  17. Perform ! CreateDataPropertyOrThrow(unscopableList,"values",true).
  18. ReturnunscopableList.

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:true }.

Note

The ownproperty names of this object areproperty names that were not included as standard properties ofArray.prototype prior to the ECMAScript 2015 specification. These names are ignored forwith statement binding purposes in order to preserve the behaviour of existing code that might use one of these names as a binding in an outer scope that is shadowed by awith statement whose binding object is an Array.

The reason that"with" is not included in theunscopableList is because it is already areserved word.

23.1.4 Properties of Array Instances

Array instances areArray exotic objects and have the internal methods specified for such objects. Array instances inherit properties from theArray prototype object.

Array instances have a"length" property, and a set of enumerable properties witharray index names.

23.1.4.1 length

The"length" property of an Array instance is adata property whose value is always numerically greater than the name of every configurable own property whose name is anarray index.

The"length" property initially has the attributes {[[Writable]]:true,[[Enumerable]]:false,[[Configurable]]:false }.

Note

Reducing the value of the"length" property has the side-effect of deleting own array elements whosearray index is between the old and new length values. However, non-configurable properties can not be deleted. Attempting to set the"length" property of an Array to a value that is numerically less than or equal to the largest numeric ownproperty name of an existing non-configurablearray-indexed property of the array will result in the length being set to a numeric value that is one greater than that non-configurable numeric ownproperty name. See10.4.2.1.

23.1.5 Array Iterator Objects

AnArray Iterator is an object that represents a specific iteration over some specific Array instance object. There is not a namedconstructor for Array Iterator objects. Instead, Array Iterator objects are created by calling certain methods of Array instance objects.

23.1.5.1 CreateArrayIterator (array,kind )

The abstract operation CreateArrayIterator takes argumentsarray (an Object) andkind (key+value,key, orvalue) and returns an Object. It is used to createiterator objects for Array methods that return suchiterators. It performs the following steps when called:

  1. Letiterator beOrdinaryObjectCreate(%ArrayIteratorPrototype%, «[[IteratedArrayLike]],[[ArrayLikeNextIndex]],[[ArrayLikeIterationKind]] »).
  2. Setiterator.[[IteratedArrayLike]] toarray.
  3. Setiterator.[[ArrayLikeNextIndex]] to 0.
  4. Setiterator.[[ArrayLikeIterationKind]] tokind.
  5. Returniterator.

23.1.5.2 The %ArrayIteratorPrototype% Object

The%ArrayIteratorPrototype% object:

23.1.5.2.1 %ArrayIteratorPrototype%.next ( )

  1. LetO be thethis value.
  2. IfOis not an Object, throw aTypeError exception.
  3. IfO does not have all of the internal slots of anArray Iterator Instance (23.1.5.3), throw aTypeError exception.
  4. Letarray beO.[[IteratedArrayLike]].
  5. Ifarray isundefined, returnCreateIteratorResultObject(undefined,true).
  6. Letindex beO.[[ArrayLikeNextIndex]].
  7. Letkind beO.[[ArrayLikeIterationKind]].
  8. Ifarray has a[[TypedArrayName]] internal slot, then
    1. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(array,seq-cst).
    2. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
    3. Letlen beTypedArrayLength(taRecord).
  9. Else,
    1. Letlen be ? LengthOfArrayLike(array).
  10. Ifindexlen, then
    1. SetO.[[IteratedArrayLike]] toundefined.
    2. ReturnCreateIteratorResultObject(undefined,true).
  11. SetO.[[ArrayLikeNextIndex]] toindex + 1.
  12. LetindexNumber be𝔽(index).
  13. Ifkind iskey, then
    1. Letresult beindexNumber.
  14. Else,
    1. LetelementKey be ! ToString(indexNumber).
    2. LetelementValue be ? Get(array,elementKey).
    3. Ifkind isvalue, then
      1. Letresult beelementValue.
    4. Else,
      1. Assert:kind iskey+value.
      2. Letresult beCreateArrayFromListindexNumber,elementValue »).
  15. ReturnCreateIteratorResultObject(result,false).

23.1.5.2.2 %ArrayIteratorPrototype% [ %Symbol.toStringTag% ]

The initial value of the%Symbol.toStringTag% property is the String value"Array Iterator".

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:true }.

23.1.5.3 Properties of Array Iterator Instances

Array Iterator instances areordinary objects that inherit properties from the%ArrayIteratorPrototype% intrinsic object.Array Iterator instances are initially created with the internal slots listed inTable 72.

Table 72: Internal Slots ofArray Iterator Instances
Internal Slot Type Description
[[IteratedArrayLike]] an Object orundefined Thearray-like object that is being iterated.
[[ArrayLikeNextIndex]] a non-negativeinteger Theinteger index of the next element to be examined by thisiterator.
[[ArrayLikeIterationKind]]key+value,key, orvalue A value that identifies what is returned for each element of the iteration.

23.2 TypedArray Objects

ATypedArray presents an array-like view of an underlying binary data buffer (25.1). ATypedArray element type is the underlying binary scalar data type that all elements of aTypedArray instance have. There is a distinctTypedArrayconstructor, listed inTable 73, for each of the supported element types. Eachconstructor inTable 73 has a corresponding distinct prototype object.

Table 73: TheTypedArrayConstructors
Constructor Name and Intrinsic Element Type Element Size Conversion Operation Description
Int8Array
%Int8Array%
int8 1ToInt8 8-bit two's complement signedinteger
Uint8Array
%Uint8Array%
uint8 1ToUint8 8-bit unsignedinteger
Uint8ClampedArray
%Uint8ClampedArray%
uint8clamped 1ToUint8Clamp 8-bit unsignedinteger (clamped conversion)
Int16Array
%Int16Array%
int16 2ToInt16 16-bit two's complement signedinteger
Uint16Array
%Uint16Array%
uint16 2ToUint16 16-bit unsignedinteger
Int32Array
%Int32Array%
int32 4ToInt32 32-bit two's complement signedinteger
Uint32Array
%Uint32Array%
uint32 4ToUint32 32-bit unsignedinteger
BigInt64Array
%BigInt64Array%
bigint64 8ToBigInt64 64-bit two's complement signedinteger
BigUint64Array
%BigUint64Array%
biguint64 8ToBigUint64 64-bit unsignedinteger
Float16Array
%Float16Array%
float16 2 16-bit IEEE floating point
Float32Array
%Float32Array%
float32 4 32-bit IEEE floating point
Float64Array
%Float64Array%
float64 8 64-bit IEEE floating point

In the definitions below, references toTypedArray should be replaced with the appropriateconstructor name from the above table.

23.2.1 The %TypedArray% Intrinsic Object

The%TypedArray% intrinsic object:

  • is aconstructorfunction object that all of theTypedArrayconstructor objects inherit from.
  • along with its corresponding prototype object, provides common properties that are inherited by allTypedArrayconstructors and their instances.
  • does not have a global name or appear as a property of theglobal object.
  • acts as the abstract superclass of the variousTypedArrayconstructors.
  • will throw an error when invoked, because it is an abstract classconstructor. TheTypedArrayconstructors do not perform asuper call to it.

23.2.1.1 %TypedArray% ( )

This function performs the following steps when called:

  1. Throw aTypeError exception.

The"length" property of this function is+0𝔽.

23.2.2 Properties of the %TypedArray% Intrinsic Object

The%TypedArray% intrinsic object:

  • has a[[Prototype]] internal slot whose value is%Function.prototype%.
  • has a"name" property whose value is"TypedArray".
  • has the following properties:

23.2.2.1 %TypedArray%.from (source [ ,mapper [ ,thisArg ] ] )

This method performs the following steps when called:

  1. LetC be thethis value.
  2. IfIsConstructor(C) isfalse, throw aTypeError exception.
  3. Ifmapper isundefined, then
    1. Letmapping befalse.
  4. Else,
    1. IfIsCallable(mapper) isfalse, throw aTypeError exception.
    2. Letmapping betrue.
  5. LetusingIterator be ? GetMethod(source,%Symbol.iterator%).
  6. IfusingIterator is notundefined, then
    1. Letvalues be ? IteratorToList(?GetIteratorFromMethod(source,usingIterator)).
    2. Letlen be the number of elements invalues.
    3. LettargetObj be ? TypedArrayCreateFromConstructor(C, «𝔽(len) »).
    4. Letk be 0.
    5. Repeat, whilek <len,
      1. LetPk be ! ToString(𝔽(k)).
      2. LetkValue be the first element ofvalues.
      3. Remove the first element fromvalues.
      4. Ifmapping istrue, then
        1. LetmappedValue be ? Call(mapper,thisArg, «kValue,𝔽(k) »).
      5. Else,
        1. LetmappedValue bekValue.
      6. Perform ? Set(targetObj,Pk,mappedValue,true).
      7. Setk tok + 1.
    6. Assert:values is now an emptyList.
    7. ReturntargetObj.
  7. NOTE:source is not aniterable object, so assume it is already anarray-like object.
  8. LetarrayLike be ! ToObject(source).
  9. Letlen be ? LengthOfArrayLike(arrayLike).
  10. LettargetObj be ? TypedArrayCreateFromConstructor(C, «𝔽(len) »).
  11. Letk be 0.
  12. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ? Get(arrayLike,Pk).
    3. Ifmapping istrue, then
      1. LetmappedValue be ? Call(mapper,thisArg, «kValue,𝔽(k) »).
    4. Else,
      1. LetmappedValue bekValue.
    5. Perform ? Set(targetObj,Pk,mappedValue,true).
    6. Setk tok + 1.
  13. ReturntargetObj.

23.2.2.2 %TypedArray%.of ( ...items )

This method performs the following steps when called:

  1. Letlen be the number of elements initems.
  2. LetC be thethis value.
  3. IfIsConstructor(C) isfalse, throw aTypeError exception.
  4. LetnewObj be ? TypedArrayCreateFromConstructor(C, «𝔽(len) »).
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. LetkValue beitems[k].
    2. LetPk be ! ToString(𝔽(k)).
    3. Perform ? Set(newObj,Pk,kValue,true).
    4. Setk tok + 1.
  7. ReturnnewObj.

23.2.2.3 %TypedArray%.prototype

The initial value of%TypedArray%.prototype is the%TypedArray% prototype object.

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:false }.

23.2.2.4 get %TypedArray% [ %Symbol.species% ]

%TypedArray%[%Symbol.species%] is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. Return thethis value.

The value of the"name" property of this function is"get [Symbol.species]".

Note

%TypedArray.prototype% methods normally use theirthis value'sconstructor to create a derived object. However, a subclassconstructor may over-ride that default behaviour by redefining its%Symbol.species% property.

23.2.3 Properties of the %TypedArray% Prototype Object

The%TypedArray% prototype object:

  • has a[[Prototype]] internal slot whose value is%Object.prototype%.
  • is%TypedArray.prototype%.
  • is anordinary object.
  • does not have a[[ViewedArrayBuffer]] or any other of the internal slots that are specific toTypedArray instance objects.

23.2.3.1 %TypedArray%.prototype.at (index )

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetrelativeIndex be ? ToIntegerOrInfinity(index).
  5. IfrelativeIndex ≥ 0, then
    1. Letk berelativeIndex.
  6. Else,
    1. Letk belen +relativeIndex.
  7. Ifk < 0 orklen, returnundefined.
  8. Return ! Get(O, ! ToString(𝔽(k))).

23.2.3.2 get %TypedArray%.prototype.buffer

%TypedArray%.prototype.buffer is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? RequireInternalSlot(O,[[TypedArrayName]]).
  3. Assert:O has a[[ViewedArrayBuffer]] internal slot.
  4. Letbuffer beO.[[ViewedArrayBuffer]].
  5. Returnbuffer.

23.2.3.3 get %TypedArray%.prototype.byteLength

%TypedArray%.prototype.byteLength is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? RequireInternalSlot(O,[[TypedArrayName]]).
  3. Assert:O has a[[ViewedArrayBuffer]] internal slot.
  4. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
  5. Letsize beTypedArrayByteLength(taRecord).
  6. Return𝔽(size).

23.2.3.4 get %TypedArray%.prototype.byteOffset

%TypedArray%.prototype.byteOffset is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? RequireInternalSlot(O,[[TypedArrayName]]).
  3. Assert:O has a[[ViewedArrayBuffer]] internal slot.
  4. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
  5. IfIsTypedArrayOutOfBounds(taRecord) istrue, return+0𝔽.
  6. Letoffset beO.[[ByteOffset]].
  7. Return𝔽(offset).

23.2.3.5 %TypedArray%.prototype.constructor

The initial value of%TypedArray%.prototype.constructor is%TypedArray%.

23.2.3.6 %TypedArray%.prototype.copyWithin (target,start [ ,end ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.copyWithin as defined in23.1.3.4.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetrelativeTarget be ? ToIntegerOrInfinity(target).
  5. IfrelativeTarget = -∞, lettargetIndex be 0.
  6. Else ifrelativeTarget < 0, lettargetIndex bemax(len +relativeTarget, 0).
  7. Else, lettargetIndex bemin(relativeTarget,len).
  8. LetrelativeStart be ? ToIntegerOrInfinity(start).
  9. IfrelativeStart = -∞, letstartIndex be 0.
  10. Else ifrelativeStart < 0, letstartIndex bemax(len +relativeStart, 0).
  11. Else, letstartIndex bemin(relativeStart,len).
  12. Ifend isundefined, letrelativeEnd belen; else letrelativeEnd be ? ToIntegerOrInfinity(end).
  13. IfrelativeEnd = -∞, letendIndex be 0.
  14. Else ifrelativeEnd < 0, letendIndex bemax(len +relativeEnd, 0).
  15. Else, letendIndex bemin(relativeEnd,len).
  16. Letcount bemin(endIndex -startIndex,len -targetIndex).
  17. Ifcount > 0, then
    1. NOTE: The copying must be performed in a manner that preserves the bit-level encoding of the source data.
    2. Letbuffer beO.[[ViewedArrayBuffer]].
    3. SettaRecord toMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
    4. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
    5. Setlen toTypedArrayLength(taRecord).
    6. NOTE: Side-effects of the above steps may have reduced the size ofO, in which case copying should proceed with the longest still-applicable prefix.
    7. Setcount tomin(count,len -startIndex,len -targetIndex).
    8. LetelementSize beTypedArrayElementSize(O).
    9. LetbyteOffset beO.[[ByteOffset]].
    10. LettoByteIndex be (targetIndex ×elementSize) +byteOffset.
    11. LetfromByteIndex be (startIndex ×elementSize) +byteOffset.
    12. LetcountBytes becount ×elementSize.
    13. IffromByteIndex <toByteIndex andtoByteIndex <fromByteIndex +countBytes, then
      1. Letdirection be -1.
      2. SetfromByteIndex tofromByteIndex +countBytes - 1.
      3. SettoByteIndex totoByteIndex +countBytes - 1.
    14. Else,
      1. Letdirection be 1.
    15. Repeat, whilecountBytes > 0,
      1. Letvalue beGetValueFromBuffer(buffer,fromByteIndex,uint8,true,unordered).
      2. PerformSetValueInBuffer(buffer,toByteIndex,uint8,value,true,unordered).
      3. SetfromByteIndex tofromByteIndex +direction.
      4. SettoByteIndex totoByteIndex +direction.
      5. SetcountBytes tocountBytes - 1.
  18. ReturnO.

23.2.3.7 %TypedArray%.prototype.entries ( )

This method performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? ValidateTypedArray(O,seq-cst).
  3. ReturnCreateArrayIterator(O,key+value).

23.2.3.8 %TypedArray%.prototype.every (callback [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.every as defined in23.1.3.6.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. LettestResult beToBoolean(?Call(callback,thisArg, «kValue,𝔽(k),O »)).
    4. IftestResult isfalse, returnfalse.
    5. Setk tok + 1.
  7. Returntrue.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.9 %TypedArray%.prototype.fill (value [ ,start [ ,end ] ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.fill as defined in23.1.3.7.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfO.[[ContentType]] isbigint, setvalue to ? ToBigInt(value).
  5. Otherwise, setvalue to ? ToNumber(value).
  6. LetrelativeStart be ? ToIntegerOrInfinity(start).
  7. IfrelativeStart = -∞, letstartIndex be 0.
  8. Else ifrelativeStart < 0, letstartIndex bemax(len +relativeStart, 0).
  9. Else, letstartIndex bemin(relativeStart,len).
  10. Ifend isundefined, letrelativeEnd belen; else letrelativeEnd be ? ToIntegerOrInfinity(end).
  11. IfrelativeEnd = -∞, letendIndex be 0.
  12. Else ifrelativeEnd < 0, letendIndex bemax(len +relativeEnd, 0).
  13. Else, letendIndex bemin(relativeEnd,len).
  14. SettaRecord toMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
  15. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
  16. Setlen toTypedArrayLength(taRecord).
  17. SetendIndex tomin(endIndex,len).
  18. Letk bestartIndex.
  19. Repeat, whilek <endIndex,
    1. LetPk be ! ToString(𝔽(k)).
    2. Perform ! Set(O,Pk,value,true).
    3. Setk tok + 1.
  20. ReturnO.

23.2.3.10 %TypedArray%.prototype.filter (callback [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.filter as defined in23.1.3.8.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. Letkept be a new emptyList.
  6. Letcaptured be 0.
  7. Letk be 0.
  8. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. Letselected beToBoolean(?Call(callback,thisArg, «kValue,𝔽(k),O »)).
    4. Ifselected istrue, then
      1. AppendkValue tokept.
      2. Setcaptured tocaptured + 1.
    5. Setk tok + 1.
  9. LetA be ? TypedArraySpeciesCreate(O, «𝔽(captured) »).
  10. Letn be 0.
  11. For each elemente ofkept, do
    1. Perform ! Set(A, ! ToString(𝔽(n)),e,true).
    2. Setn ton + 1.
  12. ReturnA.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.11 %TypedArray%.prototype.find (predicate [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.find as defined in23.1.3.9.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetfindRec be ? FindViaPredicate(O,len,ascending,predicate,thisArg).
  5. ReturnfindRec.[[Value]].

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.12 %TypedArray%.prototype.findIndex (predicate [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.findIndex as defined in23.1.3.10.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetfindRec be ? FindViaPredicate(O,len,ascending,predicate,thisArg).
  5. ReturnfindRec.[[Index]].

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.13 %TypedArray%.prototype.findLast (predicate [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.findLast as defined in23.1.3.11.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetfindRec be ? FindViaPredicate(O,len,descending,predicate,thisArg).
  5. ReturnfindRec.[[Value]].

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.14 %TypedArray%.prototype.findLastIndex (predicate [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.findLastIndex as defined in23.1.3.12.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetfindRec be ? FindViaPredicate(O,len,descending,predicate,thisArg).
  5. ReturnfindRec.[[Index]].

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.15 %TypedArray%.prototype.forEach (callback [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.forEach as defined in23.1.3.15.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. Perform ? Call(callback,thisArg, «kValue,𝔽(k),O »).
    4. Setk tok + 1.
  7. Returnundefined.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.16 %TypedArray%.prototype.includes (searchElement [ ,fromIndex ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.includes as defined in23.1.3.16.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. Iflen = 0, returnfalse.
  5. Letn be ? ToIntegerOrInfinity(fromIndex).
  6. Assert: IffromIndex isundefined, thenn is 0.
  7. Ifn = +∞, returnfalse.
  8. Else ifn = -∞, setn to 0.
  9. Ifn ≥ 0, then
    1. Letk ben.
  10. Else,
    1. Letk belen +n.
    2. Ifk < 0, setk to 0.
  11. Repeat, whilek <len,
    1. LetelementK be ! Get(O, ! ToString(𝔽(k))).
    2. IfSameValueZero(searchElement,elementK) istrue, returntrue.
    3. Setk tok + 1.
  12. Returnfalse.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.17 %TypedArray%.prototype.indexOf (searchElement [ ,fromIndex ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.indexOf as defined in23.1.3.17.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. Iflen = 0, return-1𝔽.
  5. Letn be ? ToIntegerOrInfinity(fromIndex).
  6. Assert: IffromIndex isundefined, thenn is 0.
  7. Ifn = +∞, return-1𝔽.
  8. Else ifn = -∞, setn to 0.
  9. Ifn ≥ 0, then
    1. Letk ben.
  10. Else,
    1. Letk belen +n.
    2. Ifk < 0, setk to 0.
  11. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ! HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetelementK be ! Get(O,Pk).
      2. IfIsStrictlyEqual(searchElement,elementK) istrue, return𝔽(k).
    4. Setk tok + 1.
  12. Return-1𝔽.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.18 %TypedArray%.prototype.join (separator )

The interpretation and use of the arguments of this method are the same as forArray.prototype.join as defined in23.1.3.18.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. Ifseparator isundefined, letsep be",".
  5. Else, letsep be ? ToString(separator).
  6. LetR be the empty String.
  7. Letk be 0.
  8. Repeat, whilek <len,
    1. Ifk > 0, setR to thestring-concatenation ofR andsep.
    2. Letelement be ! Get(O, ! ToString(𝔽(k))).
    3. Ifelement is notundefined, then
      1. LetS be ! ToString(element).
      2. SetR to thestring-concatenation ofR andS.
    4. Setk tok + 1.
  9. ReturnR.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.19 %TypedArray%.prototype.keys ( )

This method performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? ValidateTypedArray(O,seq-cst).
  3. ReturnCreateArrayIterator(O,key).

23.2.3.20 %TypedArray%.prototype.lastIndexOf (searchElement [ ,fromIndex ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.lastIndexOf as defined in23.1.3.20.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. Iflen = 0, return-1𝔽.
  5. IffromIndex is present, letn be ? ToIntegerOrInfinity(fromIndex); else letn belen - 1.
  6. Ifn = -∞, return-1𝔽.
  7. Ifn ≥ 0, then
    1. Letk bemin(n,len - 1).
  8. Else,
    1. Letk belen +n.
  9. Repeat, whilek ≥ 0,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkPresent be ! HasProperty(O,Pk).
    3. IfkPresent istrue, then
      1. LetelementK be ! Get(O,Pk).
      2. IfIsStrictlyEqual(searchElement,elementK) istrue, return𝔽(k).
    4. Setk tok - 1.
  10. Return-1𝔽.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.21 get %TypedArray%.prototype.length

%TypedArray%.prototype.length is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? RequireInternalSlot(O,[[TypedArrayName]]).
  3. Assert:O has[[ViewedArrayBuffer]] and[[ArrayLength]] internal slots.
  4. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
  5. IfIsTypedArrayOutOfBounds(taRecord) istrue, return+0𝔽.
  6. Letlength beTypedArrayLength(taRecord).
  7. Return𝔽(length).

This function is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.22 %TypedArray%.prototype.map (callback [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.map as defined in23.1.3.21.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. LetA be ? TypedArraySpeciesCreate(O, «𝔽(len) »).
  6. Letk be 0.
  7. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. LetmappedValue be ? Call(callback,thisArg, «kValue,𝔽(k),O »).
    4. Perform ? Set(A,Pk,mappedValue,true).
    5. Setk tok + 1.
  8. ReturnA.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.23 %TypedArray%.prototype.reduce (callback [ ,initialValue ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.reduce as defined in23.1.3.24.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. Iflen = 0 andinitialValue is not present, throw aTypeError exception.
  6. Letk be 0.
  7. Letaccumulator beundefined.
  8. IfinitialValue is present, then
    1. Setaccumulator toinitialValue.
  9. Else,
    1. LetPk be ! ToString(𝔽(k)).
    2. Setaccumulator to ! Get(O,Pk).
    3. Setk tok + 1.
  10. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. Setaccumulator to ? Call(callback,undefined, «accumulator,kValue,𝔽(k),O »).
    4. Setk tok + 1.
  11. Returnaccumulator.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.24 %TypedArray%.prototype.reduceRight (callback [ ,initialValue ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.reduceRight as defined in23.1.3.25.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. Iflen = 0 andinitialValue is not present, throw aTypeError exception.
  6. Letk belen - 1.
  7. Letaccumulator beundefined.
  8. IfinitialValue is present, then
    1. Setaccumulator toinitialValue.
  9. Else,
    1. LetPk be ! ToString(𝔽(k)).
    2. Setaccumulator to ! Get(O,Pk).
    3. Setk tok - 1.
  10. Repeat, whilek ≥ 0,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. Setaccumulator to ? Call(callback,undefined, «accumulator,kValue,𝔽(k),O »).
    4. Setk tok - 1.
  11. Returnaccumulator.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.25 %TypedArray%.prototype.reverse ( )

The interpretation and use of the arguments of this method are the same as forArray.prototype.reverse as defined in23.1.3.26.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. Letmiddle befloor(len / 2).
  5. Letlower be 0.
  6. Repeat, whilelowermiddle,
    1. Letupper belen -lower - 1.
    2. LetupperP be ! ToString(𝔽(upper)).
    3. LetlowerP be ! ToString(𝔽(lower)).
    4. LetlowerValue be ! Get(O,lowerP).
    5. LetupperValue be ! Get(O,upperP).
    6. Perform ! Set(O,lowerP,upperValue,true).
    7. Perform ! Set(O,upperP,lowerValue,true).
    8. Setlower tolower + 1.
  7. ReturnO.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.26 %TypedArray%.prototype.set (source [ ,offset ] )

This method sets multiple values in thisTypedArray, reading the values fromsource. The details differ based upon the type ofsource. The optionaloffset value indicates the first element index in thisTypedArray where values are written. If omitted, it is assumed to be 0.

It performs the following steps when called:

  1. Lettarget be thethis value.
  2. Perform ? RequireInternalSlot(target,[[TypedArrayName]]).
  3. Assert:target has a[[ViewedArrayBuffer]] internal slot.
  4. LettargetOffset be ? ToIntegerOrInfinity(offset).
  5. IftargetOffset < 0, throw aRangeError exception.
  6. Ifsourceis an Object that has a[[TypedArrayName]] internal slot, then
    1. Perform ? SetTypedArrayFromTypedArray(target,targetOffset,source).
  7. Else,
    1. Perform ? SetTypedArrayFromArrayLike(target,targetOffset,source).
  8. Returnundefined.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.26.1 SetTypedArrayFromArrayLike (target,targetOffset,source )

The abstract operation SetTypedArrayFromArrayLike takes argumentstarget (aTypedArray),targetOffset (a non-negativeinteger or +∞), andsource (anECMAScript language value, but not aTypedArray) and returns either anormal completion containingunused or athrow completion. It sets multiple values intarget, starting at indextargetOffset, reading the values fromsource. It performs the following steps when called:

  1. LettargetRecord beMakeTypedArrayWithBufferWitnessRecord(target,seq-cst).
  2. IfIsTypedArrayOutOfBounds(targetRecord) istrue, throw aTypeError exception.
  3. LettargetLength beTypedArrayLength(targetRecord).
  4. Letsrc be ? ToObject(source).
  5. LetsrcLength be ? LengthOfArrayLike(src).
  6. IftargetOffset = +∞, throw aRangeError exception.
  7. IfsrcLength +targetOffset >targetLength, throw aRangeError exception.
  8. Letk be 0.
  9. Repeat, whilek <srcLength,
    1. LetPk be ! ToString(𝔽(k)).
    2. Letvalue be ? Get(src,Pk).
    3. LettargetIndex be𝔽(targetOffset +k).
    4. Perform ? TypedArraySetElement(target,targetIndex,value).
    5. Setk tok + 1.
  10. Returnunused.

23.2.3.26.2 SetTypedArrayFromTypedArray (target,targetOffset,source )

The abstract operation SetTypedArrayFromTypedArray takes argumentstarget (aTypedArray),targetOffset (a non-negativeinteger or +∞), andsource (aTypedArray) and returns either anormal completion containingunused or athrow completion. It sets multiple values intarget, starting at indextargetOffset, reading the values fromsource. It performs the following steps when called:

  1. LettargetBuffer betarget.[[ViewedArrayBuffer]].
  2. LettargetRecord beMakeTypedArrayWithBufferWitnessRecord(target,seq-cst).
  3. IfIsTypedArrayOutOfBounds(targetRecord) istrue, throw aTypeError exception.
  4. LettargetLength beTypedArrayLength(targetRecord).
  5. LetsrcBuffer besource.[[ViewedArrayBuffer]].
  6. LetsrcRecord beMakeTypedArrayWithBufferWitnessRecord(source,seq-cst).
  7. IfIsTypedArrayOutOfBounds(srcRecord) istrue, throw aTypeError exception.
  8. LetsrcLength beTypedArrayLength(srcRecord).
  9. LettargetType beTypedArrayElementType(target).
  10. LettargetElementSize beTypedArrayElementSize(target).
  11. LettargetByteOffset betarget.[[ByteOffset]].
  12. LetsrcType beTypedArrayElementType(source).
  13. LetsrcElementSize beTypedArrayElementSize(source).
  14. LetsrcByteOffset besource.[[ByteOffset]].
  15. IftargetOffset = +∞, throw aRangeError exception.
  16. IfsrcLength +targetOffset >targetLength, throw aRangeError exception.
  17. Iftarget.[[ContentType]] is notsource.[[ContentType]], throw aTypeError exception.
  18. IfIsSharedArrayBuffer(srcBuffer) istrue,IsSharedArrayBuffer(targetBuffer) istrue, andsrcBuffer.[[ArrayBufferData]] istargetBuffer.[[ArrayBufferData]], letsameSharedArrayBuffer betrue; otherwise letsameSharedArrayBuffer befalse.
  19. IfSameValue(srcBuffer,targetBuffer) istrue orsameSharedArrayBuffer istrue, then
    1. LetsrcByteLength beTypedArrayByteLength(srcRecord).
    2. SetsrcBuffer to ? CloneArrayBuffer(srcBuffer,srcByteOffset,srcByteLength).
    3. LetsrcByteIndex be 0.
  20. Else,
    1. LetsrcByteIndex besrcByteOffset.
  21. LettargetByteIndex be (targetOffset ×targetElementSize) +targetByteOffset.
  22. Letlimit betargetByteIndex + (targetElementSize ×srcLength).
  23. IfsrcType istargetType, then
    1. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data.
    2. Repeat, whiletargetByteIndex <limit,
      1. Letvalue beGetValueFromBuffer(srcBuffer,srcByteIndex,uint8,true,unordered).
      2. PerformSetValueInBuffer(targetBuffer,targetByteIndex,uint8,value,true,unordered).
      3. SetsrcByteIndex tosrcByteIndex + 1.
      4. SettargetByteIndex totargetByteIndex + 1.
  24. Else,
    1. Repeat, whiletargetByteIndex <limit,
      1. Letvalue beGetValueFromBuffer(srcBuffer,srcByteIndex,srcType,true,unordered).
      2. PerformSetValueInBuffer(targetBuffer,targetByteIndex,targetType,value,true,unordered).
      3. SetsrcByteIndex tosrcByteIndex +srcElementSize.
      4. SettargetByteIndex totargetByteIndex +targetElementSize.
  25. Returnunused.

23.2.3.27 %TypedArray%.prototype.slice (start,end )

The interpretation and use of the arguments of this method are the same as forArray.prototype.slice as defined in23.1.3.28.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. LetsrcArrayLength beTypedArrayLength(taRecord).
  4. LetrelativeStart be ? ToIntegerOrInfinity(start).
  5. IfrelativeStart = -∞, letstartIndex be 0.
  6. Else ifrelativeStart < 0, letstartIndex bemax(srcArrayLength +relativeStart, 0).
  7. Else, letstartIndex bemin(relativeStart,srcArrayLength).
  8. Ifend isundefined, letrelativeEnd besrcArrayLength; else letrelativeEnd be ? ToIntegerOrInfinity(end).
  9. IfrelativeEnd = -∞, letendIndex be 0.
  10. Else ifrelativeEnd < 0, letendIndex bemax(srcArrayLength +relativeEnd, 0).
  11. Else, letendIndex bemin(relativeEnd,srcArrayLength).
  12. LetcountBytes bemax(endIndex -startIndex, 0).
  13. LetA be ? TypedArraySpeciesCreate(O, «𝔽(countBytes) »).
  14. IfcountBytes > 0, then
    1. SettaRecord toMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
    2. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
    3. SetendIndex tomin(endIndex,TypedArrayLength(taRecord)).
    4. SetcountBytes tomax(endIndex -startIndex, 0).
    5. LetsrcType beTypedArrayElementType(O).
    6. LettargetType beTypedArrayElementType(A).
    7. IfsrcType istargetType, then
      1. NOTE: The transfer must be performed in a manner that preserves the bit-level encoding of the source data.
      2. LetsrcBuffer beO.[[ViewedArrayBuffer]].
      3. LettargetBuffer beA.[[ViewedArrayBuffer]].
      4. LetelementSize beTypedArrayElementSize(O).
      5. LetsrcByteOffset beO.[[ByteOffset]].
      6. LetsrcByteIndex be (startIndex ×elementSize) +srcByteOffset.
      7. LettargetByteIndex beA.[[ByteOffset]].
      8. LetendByteIndex betargetByteIndex + (countBytes ×elementSize).
      9. Repeat, whiletargetByteIndex <endByteIndex,
        1. Letvalue beGetValueFromBuffer(srcBuffer,srcByteIndex,uint8,true,unordered).
        2. PerformSetValueInBuffer(targetBuffer,targetByteIndex,uint8,value,true,unordered).
        3. SetsrcByteIndex tosrcByteIndex + 1.
        4. SettargetByteIndex totargetByteIndex + 1.
    8. Else,
      1. Letn be 0.
      2. Letk bestartIndex.
      3. Repeat, whilek <endIndex,
        1. LetPk be ! ToString(𝔽(k)).
        2. LetkValue be ! Get(O,Pk).
        3. Perform ! Set(A, ! ToString(𝔽(n)),kValue,true).
        4. Setk tok + 1.
        5. Setn ton + 1.
  15. ReturnA.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.28 %TypedArray%.prototype.some (callback [ ,thisArg ] )

The interpretation and use of the arguments of this method are the same as forArray.prototype.some as defined in23.1.3.29.

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. IfIsCallable(callback) isfalse, throw aTypeError exception.
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ! Get(O,Pk).
    3. LettestResult beToBoolean(?Call(callback,thisArg, «kValue,𝔽(k),O »)).
    4. IftestResult istrue, returntrue.
    5. Setk tok + 1.
  7. Returnfalse.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.29 %TypedArray%.prototype.sort (comparator )

This is a distinct method that, except as described below, implements the same requirements as those ofArray.prototype.sort as defined in23.1.3.30. The implementation of this method may be optimized with the knowledge that thethis value is an object that has a fixed length and whoseinteger-indexed properties are not sparse.

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

It performs the following steps when called:

  1. Ifcomparator is notundefined andIsCallable(comparator) isfalse, throw aTypeError exception.
  2. Letobj be thethis value.
  3. LettaRecord be ? ValidateTypedArray(obj,seq-cst).
  4. Letlen beTypedArrayLength(taRecord).
  5. NOTE: The following closure performs a numeric comparison rather than the string comparison used in23.1.3.30.
  6. LetSortCompare be a newAbstract Closure with parameters (x,y) that capturescomparator and performs the following steps when called:
    1. Return ? CompareTypedArrayElements(x,y,comparator).
  7. LetsortedList be ? SortIndexedProperties(obj,len,SortCompare,read-through-holes).
  8. Letj be 0.
  9. Repeat, whilej <len,
    1. Perform ! Set(obj, ! ToString(𝔽(j)),sortedList[j],true).
    2. Setj toj + 1.
  10. Returnobj.
Note

BecauseNaN always compares greater than any other value (seeCompareTypedArrayElements),NaN property values always sort to the end of the result whencomparator is not provided.

23.2.3.30 %TypedArray%.prototype.subarray (start,end )

This method returns a newTypedArray whose element type is the element type of thisTypedArray and whose ArrayBuffer is the ArrayBuffer of thisTypedArray, referencing the elements in theinterval fromstart (inclusive) toend (exclusive). If eitherstart orend is negative, it refers to an index from the end of the array, as opposed to from the beginning.

It performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? RequireInternalSlot(O,[[TypedArrayName]]).
  3. Assert:O has a[[ViewedArrayBuffer]] internal slot.
  4. Letbuffer beO.[[ViewedArrayBuffer]].
  5. LetsrcRecord beMakeTypedArrayWithBufferWitnessRecord(O,seq-cst).
  6. IfIsTypedArrayOutOfBounds(srcRecord) istrue, then
    1. LetsrcLength be 0.
  7. Else,
    1. LetsrcLength beTypedArrayLength(srcRecord).
  8. LetrelativeStart be ? ToIntegerOrInfinity(start).
  9. IfrelativeStart = -∞, letstartIndex be 0.
  10. Else ifrelativeStart < 0, letstartIndex bemax(srcLength +relativeStart, 0).
  11. Else, letstartIndex bemin(relativeStart,srcLength).
  12. LetelementSize beTypedArrayElementSize(O).
  13. LetsrcByteOffset beO.[[ByteOffset]].
  14. LetbeginByteOffset besrcByteOffset + (startIndex ×elementSize).
  15. IfO.[[ArrayLength]] isauto andend isundefined, then
    1. LetargumentsList be «buffer,𝔽(beginByteOffset) ».
  16. Else,
    1. Ifend isundefined, letrelativeEnd besrcLength; else letrelativeEnd be ? ToIntegerOrInfinity(end).
    2. IfrelativeEnd = -∞, letendIndex be 0.
    3. Else ifrelativeEnd < 0, letendIndex bemax(srcLength +relativeEnd, 0).
    4. Else, letendIndex bemin(relativeEnd,srcLength).
    5. LetnewLength bemax(endIndex -startIndex, 0).
    6. LetargumentsList be «buffer,𝔽(beginByteOffset),𝔽(newLength) ».
  17. Return ? TypedArraySpeciesCreate(O,argumentsList).

This method is not generic. Thethis value must be an object with a[[TypedArrayName]] internal slot.

23.2.3.31 %TypedArray%.prototype.toLocaleString ( [reserved1 [ ,reserved2 ] ] )

This is a distinct method that implements the same algorithm asArray.prototype.toLocaleString as defined in23.1.3.32 except thatTypedArrayLength is called in place of performing a[[Get]] of"length". The implementation of the algorithm may be optimized with the knowledge that thethis value has a fixed length when the underlying buffer is not resizable and whoseinteger-indexed properties are not sparse. However, such optimization must not introduce any observable changes in the specified behaviour of the algorithm.

This method is not generic.ValidateTypedArray is called with thethis value andseq-cst as arguments prior to evaluating the algorithm. If its result is anabrupt completion that exception is thrown instead of evaluating the algorithm.

Note

If the ECMAScript implementation includes the ECMA-402 Internationalization API this method is based upon the algorithm forArray.prototype.toLocaleString that is in the ECMA-402 specification.

23.2.3.32 %TypedArray%.prototype.toReversed ( )

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetA be ? TypedArrayCreateSameType(O,len).
  5. Letk be 0.
  6. Repeat, whilek <len,
    1. Letfrom be ! ToString(𝔽(len -k - 1)).
    2. LetPk be ! ToString(𝔽(k)).
    3. LetfromValue be ! Get(O,from).
    4. Perform ! Set(A,Pk,fromValue,true).
    5. Setk tok + 1.
  7. ReturnA.

23.2.3.33 %TypedArray%.prototype.toSorted (comparator )

This method performs the following steps when called:

  1. Ifcomparator is notundefined andIsCallable(comparator) isfalse, throw aTypeError exception.
  2. LetO be thethis value.
  3. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  4. Letlen beTypedArrayLength(taRecord).
  5. LetA be ? TypedArrayCreateSameType(O,len).
  6. NOTE: The following closure performs a numeric comparison rather than the string comparison used in23.1.3.34.
  7. LetSortCompare be a newAbstract Closure with parameters (x,y) that capturescomparator and performs the following steps when called:
    1. Return ? CompareTypedArrayElements(x,y,comparator).
  8. LetsortedList be ? SortIndexedProperties(O,len,SortCompare,read-through-holes).
  9. Letj be 0.
  10. Repeat, whilej <len,
    1. Perform ! Set(A, ! ToString(𝔽(j)),sortedList[j],true).
    2. Setj toj + 1.
  11. ReturnA.

23.2.3.34 %TypedArray%.prototype.toString ( )

The initial value of the"toString" property is %Array.prototype.toString%, defined in23.1.3.36.

23.2.3.35 %TypedArray%.prototype.values ( )

This method performs the following steps when called:

  1. LetO be thethis value.
  2. Perform ? ValidateTypedArray(O,seq-cst).
  3. ReturnCreateArrayIterator(O,value).

23.2.3.36 %TypedArray%.prototype.with (index,value )

This method performs the following steps when called:

  1. LetO be thethis value.
  2. LettaRecord be ? ValidateTypedArray(O,seq-cst).
  3. Letlen beTypedArrayLength(taRecord).
  4. LetrelativeIndex be ? ToIntegerOrInfinity(index).
  5. IfrelativeIndex ≥ 0, letactualIndex berelativeIndex.
  6. Else, letactualIndex belen +relativeIndex.
  7. IfO.[[ContentType]] isbigint, letnumericValue be ? ToBigInt(value).
  8. Else, letnumericValue be ? ToNumber(value).
  9. IfIsValidIntegerIndex(O,𝔽(actualIndex)) isfalse, throw aRangeError exception.
  10. LetA be ? TypedArrayCreateSameType(O,len).
  11. Letk be 0.
  12. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. Ifk =actualIndex, letfromValue benumericValue.
    3. Else, letfromValue be ! Get(O,Pk).
    4. Perform ! Set(A,Pk,fromValue,true).
    5. Setk tok + 1.
  13. ReturnA.

23.2.3.37 %TypedArray%.prototype [ %Symbol.iterator% ] ( )

The initial value of the%Symbol.iterator% property is %TypedArray.prototype.values%, defined in23.2.3.35.

23.2.3.38 get %TypedArray%.prototype [ %Symbol.toStringTag% ]

%TypedArray%.prototype[%Symbol.toStringTag%] is anaccessor property whose set accessor function isundefined. Its get accessor function performs the following steps when called:

  1. LetO be thethis value.
  2. IfOis not an Object, returnundefined.
  3. IfO does not have a[[TypedArrayName]] internal slot, returnundefined.
  4. Letname beO.[[TypedArrayName]].
  5. Assert:nameis a String.
  6. Returnname.

This property has the attributes {[[Enumerable]]:false,[[Configurable]]:true }.

The initial value of the"name" property of this function is"get [Symbol.toStringTag]".

23.2.4 Abstract Operations for TypedArray Objects

23.2.4.1 TypedArrayCreateFromConstructor (constructor,argumentList )

The abstract operation TypedArrayCreateFromConstructor takes argumentsconstructor (aconstructor) andargumentList (aList ofECMAScript language values) and returns either anormal completion containing aTypedArray or athrow completion. It is used to specify the creation of a newTypedArray using aconstructor function. It performs the following steps when called:

  1. LetnewTypedArray be ? Construct(constructor,argumentList).
  2. LettaRecord be ? ValidateTypedArray(newTypedArray,seq-cst).
  3. Assert:newTypedArray has all the internal slots mentioned inProperties ofTypedArray Instances.
  4. If the number of elements inargumentList is 1 andargumentList[0]is a Number, then
    1. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
    2. Letlength beTypedArrayLength(taRecord).
    3. Iflength <(argumentList[0]), throw aTypeError exception.
  5. ReturnnewTypedArray.

23.2.4.2 TypedArrayCreateSameType (exemplar,length )

The abstract operation TypedArrayCreateSameType takes argumentsexemplar (aTypedArray) andlength (a non-negativeinteger) and returns either anormal completion containing aTypedArray or athrow completion. It is used to specify the creation of a newTypedArray using aconstructor function that is derived fromexemplar. UnlikeTypedArraySpeciesCreate, which can construct customTypedArray subclasses through the use of%Symbol.species%, this operation always uses one of the built-inTypedArrayconstructors. It performs the following steps when called:

  1. Letconstructor be the intrinsic object associated with theconstructor nameexemplar.[[TypedArrayName]] inTable 73.
  2. Letresult be ? TypedArrayCreateFromConstructor(constructor, «𝔽(length) »).
  3. Assert:result has[[TypedArrayName]] and[[ContentType]] internal slots.
  4. Assert:result.[[ContentType]] isexemplar.[[ContentType]].
  5. Returnresult.

23.2.4.3 TypedArraySpeciesCreate (exemplar,argumentList )

The abstract operation TypedArraySpeciesCreate takes argumentsexemplar (aTypedArray) andargumentList (aList ofECMAScript language values) and returns either anormal completion containing aTypedArray or athrow completion. It is used to specify the creation of a newTypedArray using aconstructor function that is derived fromexemplar. UnlikeArraySpeciesCreate, which can create non-Array objects through the use of%Symbol.species%, this operation enforces that theconstructor function creates an actualTypedArray. It performs the following steps when called:

  1. LetdefaultConstructor be the intrinsic object associated with theconstructor nameexemplar.[[TypedArrayName]] inTable 73.
  2. Letconstructor be ? SpeciesConstructor(exemplar,defaultConstructor).
  3. Letresult be ? TypedArrayCreateFromConstructor(constructor,argumentList).
  4. Ifresult.[[ContentType]] is notexemplar.[[ContentType]], throw aTypeError exception.
  5. Returnresult.

23.2.4.4 ValidateTypedArray (O,order )

The abstract operation ValidateTypedArray takes argumentsO (anECMAScript language value) andorder (seq-cst orunordered) and returns either anormal completion containing aTypedArray With Buffer Witness Record or athrow completion. It performs the following steps when called:

  1. Perform ? RequireInternalSlot(O,[[TypedArrayName]]).
  2. Assert:O has a[[ViewedArrayBuffer]] internal slot.
  3. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(O,order).
  4. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
  5. ReturntaRecord.

23.2.4.5 TypedArrayElementSize (O )

The abstract operation TypedArrayElementSize takes argumentO (aTypedArray) and returns a non-negativeinteger. It performs the following steps when called:

  1. Return the Element Size value specified inTable 73 forO.[[TypedArrayName]].

23.2.4.6 TypedArrayElementType (O )

The abstract operation TypedArrayElementType takes argumentO (aTypedArray) and returns aTypedArray element type. It performs the following steps when called:

  1. Return the Element Type value specified inTable 73 forO.[[TypedArrayName]].

23.2.4.7 CompareTypedArrayElements (x,y,comparator )

The abstract operation CompareTypedArrayElements takes argumentsx (a Number or a BigInt),y (a Number or a BigInt), andcomparator (afunction object orundefined) and returns either anormal completion containing a Number or anabrupt completion. It performs the following steps when called:

  1. Assert:xis a Number andyis a Number, orxis a BigInt andyis a BigInt.
  2. Ifcomparator is notundefined, then
    1. Letv be ? ToNumber(?Call(comparator,undefined, «x,y »)).
    2. Ifv isNaN, return+0𝔽.
    3. Returnv.
  3. Ifx andy are bothNaN, return+0𝔽.
  4. Ifx isNaN, return1𝔽.
  5. Ify isNaN, return-1𝔽.
  6. Ifx <y, return-1𝔽.
  7. Ifx >y, return1𝔽.
  8. Ifx is-0𝔽 andy is+0𝔽, return-1𝔽.
  9. Ifx is+0𝔽 andy is-0𝔽, return1𝔽.
  10. Return+0𝔽.
Note
This performs a numeric comparison rather than the string comparison used in23.1.3.30.2.

23.2.5 TheTypedArray Constructors

EachTypedArrayconstructor:

  • is an intrinsic object that has the structure described below, differing only in the name used as theconstructor name instead ofTypedArray, inTable 73, except where otherwise noted.
  • is a function whose behaviour differs based upon the number and types of its arguments. The actual behaviour of a call ofTypedArray depends upon the number and kind of arguments that are passed to it.
  • is not intended to be called as a function and will throw an exception when called in that manner.
  • may be used as the value of anextends clause of a class definition. Subclassconstructors that intend to inherit the specifiedTypedArray behaviour must include asuper call to theTypedArrayconstructor to create and initialize the subclass instance with the internal state necessary to support the%TypedArray%.prototype built-in methods.

23.2.5.1TypedArray ( ...args )

EachTypedArrayconstructor performs the following steps when called:

  1. If NewTarget isundefined, throw aTypeError exception.
  2. LetconstructorName be the String value of theConstructor Name value specified inTable 73 for thisTypedArrayconstructor.
  3. Letproto be"%TypedArray.prototype%".
  4. LetnumberOfArgs be the number of elements inargs.
  5. IfnumberOfArgs = 0, then
    1. Return ? AllocateTypedArray(constructorName, NewTarget,proto, 0).
  6. Else,
    1. LetfirstArgument beargs[0].
    2. IffirstArgumentis an Object, then
      1. LetO be ? AllocateTypedArray(constructorName, NewTarget,proto).
      2. IffirstArgument has a[[TypedArrayName]] internal slot, then
        1. Perform ? InitializeTypedArrayFromTypedArray(O,firstArgument).
      3. Else iffirstArgument has an[[ArrayBufferData]] internal slot, then
        1. IfnumberOfArgs > 1, letbyteOffset beargs[1]; else letbyteOffset beundefined.
        2. IfnumberOfArgs > 2, letlength beargs[2]; else letlength beundefined.
        3. Perform ? InitializeTypedArrayFromArrayBuffer(O,firstArgument,byteOffset,length).
      4. Else,
        1. Assert:firstArgumentis an Object andfirstArgument does not have either a[[TypedArrayName]] or an[[ArrayBufferData]] internal slot.
        2. LetusingIterator be ? GetMethod(firstArgument,%Symbol.iterator%).
        3. IfusingIterator is notundefined, then
          1. Letvalues be ? IteratorToList(?GetIteratorFromMethod(firstArgument,usingIterator)).
          2. Perform ? InitializeTypedArrayFromList(O,values).
        4. Else,
          1. NOTE:firstArgument is not aniterable object, so assume it is already anarray-like object.
          2. Perform ? InitializeTypedArrayFromArrayLike(O,firstArgument).
      5. ReturnO.
    3. Else,
      1. Assert:firstArgumentis not an Object.
      2. LetelementLength be ? ToIndex(firstArgument).
      3. Return ? AllocateTypedArray(constructorName, NewTarget,proto,elementLength).

23.2.5.1.1 AllocateTypedArray (constructorName,newTarget,defaultProto [ ,length ] )

The abstract operation AllocateTypedArray takes argumentsconstructorName (a String which is the name of aTypedArrayconstructor inTable 73),newTarget (aconstructor), anddefaultProto (a String) and optional argumentlength (a non-negativeinteger) and returns either anormal completion containing aTypedArray or athrow completion. It is used to validate and create an instance of aTypedArrayconstructor. If thelength argument is passed, an ArrayBuffer of that length is also allocated and associated with the newTypedArray instance. AllocateTypedArray provides common semantics that is used byTypedArray. It performs the following steps when called:

  1. Letproto be ? GetPrototypeFromConstructor(newTarget,defaultProto).
  2. Letobj beTypedArrayCreate(proto).
  3. Assert:obj.[[ViewedArrayBuffer]] isundefined.
  4. Setobj.[[TypedArrayName]] toconstructorName.
  5. IfconstructorName is either"BigInt64Array" or"BigUint64Array", setobj.[[ContentType]] tobigint.
  6. Otherwise, setobj.[[ContentType]] tonumber.
  7. Iflength is not present, then
    1. Setobj.[[ByteLength]] to 0.
    2. Setobj.[[ByteOffset]] to 0.
    3. Setobj.[[ArrayLength]] to 0.
  8. Else,
    1. Perform ? AllocateTypedArrayBuffer(obj,length).
  9. Returnobj.

23.2.5.1.2 InitializeTypedArrayFromTypedArray (O,srcArray )

The abstract operation InitializeTypedArrayFromTypedArray takes argumentsO (aTypedArray) andsrcArray (aTypedArray) and returns either anormal completion containingunused or athrow completion. It performs the following steps when called:

  1. LetsrcData besrcArray.[[ViewedArrayBuffer]].
  2. LetelementType beTypedArrayElementType(O).
  3. LetelementSize beTypedArrayElementSize(O).
  4. LetsrcType beTypedArrayElementType(srcArray).
  5. LetsrcElementSize beTypedArrayElementSize(srcArray).
  6. LetsrcByteOffset besrcArray.[[ByteOffset]].
  7. LetsrcRecord beMakeTypedArrayWithBufferWitnessRecord(srcArray,seq-cst).
  8. IfIsTypedArrayOutOfBounds(srcRecord) istrue, throw aTypeError exception.
  9. LetelementLength beTypedArrayLength(srcRecord).
  10. LetbyteLength beelementSize ×elementLength.
  11. IfelementType issrcType, then
    1. Letdata be ? CloneArrayBuffer(srcData,srcByteOffset,byteLength).
  12. Else,
    1. Letdata be ? AllocateArrayBuffer(%ArrayBuffer%,byteLength).
    2. IfsrcArray.[[ContentType]] is notO.[[ContentType]], throw aTypeError exception.
    3. LetsrcByteIndex besrcByteOffset.
    4. LettargetByteIndex be 0.
    5. Letcount beelementLength.
    6. Repeat, whilecount > 0,
      1. Letvalue beGetValueFromBuffer(srcData,srcByteIndex,srcType,true,unordered).
      2. PerformSetValueInBuffer(data,targetByteIndex,elementType,value,true,unordered).
      3. SetsrcByteIndex tosrcByteIndex +srcElementSize.
      4. SettargetByteIndex totargetByteIndex +elementSize.
      5. Setcount tocount - 1.
  13. SetO.[[ViewedArrayBuffer]] todata.
  14. SetO.[[ByteLength]] tobyteLength.
  15. SetO.[[ByteOffset]] to 0.
  16. SetO.[[ArrayLength]] toelementLength.
  17. Returnunused.

23.2.5.1.3 InitializeTypedArrayFromArrayBuffer (O,buffer,byteOffset,length )

The abstract operation InitializeTypedArrayFromArrayBuffer takes argumentsO (aTypedArray),buffer (an ArrayBuffer or a SharedArrayBuffer),byteOffset (anECMAScript language value), andlength (anECMAScript language value) and returns either anormal completion containingunused or athrow completion. It performs the following steps when called:

  1. LetelementSize beTypedArrayElementSize(O).
  2. Letoffset be ? ToIndex(byteOffset).
  3. IfoffsetmoduloelementSize ≠ 0, throw aRangeError exception.
  4. LetbufferIsFixedLength beIsFixedLengthArrayBuffer(buffer).
  5. Iflength is notundefined, then
    1. LetnewLength be ? ToIndex(length).
  6. IfIsDetachedBuffer(buffer) istrue, throw aTypeError exception.
  7. LetbufferByteLength beArrayBufferByteLength(buffer,seq-cst).
  8. Iflength isundefined andbufferIsFixedLength isfalse, then
    1. Ifoffset >bufferByteLength, throw aRangeError exception.
    2. SetO.[[ByteLength]] toauto.
    3. SetO.[[ArrayLength]] toauto.
  9. Else,
    1. Iflength isundefined, then
      1. IfbufferByteLengthmoduloelementSize ≠ 0, throw aRangeError exception.
      2. LetnewByteLength bebufferByteLength -offset.
      3. IfnewByteLength < 0, throw aRangeError exception.
    2. Else,
      1. LetnewByteLength benewLength ×elementSize.
      2. Ifoffset +newByteLength >bufferByteLength, throw aRangeError exception.
    3. SetO.[[ByteLength]] tonewByteLength.
    4. SetO.[[ArrayLength]] tonewByteLength /elementSize.
  10. SetO.[[ViewedArrayBuffer]] tobuffer.
  11. SetO.[[ByteOffset]] tooffset.
  12. Returnunused.

23.2.5.1.4 InitializeTypedArrayFromList (O,values )

The abstract operation InitializeTypedArrayFromList takes argumentsO (aTypedArray) andvalues (aList ofECMAScript language values) and returns either anormal completion containingunused or athrow completion. It performs the following steps when called:

  1. Letlen be the number of elements invalues.
  2. Perform ? AllocateTypedArrayBuffer(O,len).
  3. Letk be 0.
  4. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be the first element ofvalues.
    3. Remove the first element fromvalues.
    4. Perform ? Set(O,Pk,kValue,true).
    5. Setk tok + 1.
  5. Assert:values is now an emptyList.
  6. Returnunused.

23.2.5.1.5 InitializeTypedArrayFromArrayLike (O,arrayLike )

The abstract operation InitializeTypedArrayFromArrayLike takes argumentsO (aTypedArray) andarrayLike (an Object, but not aTypedArray or an ArrayBuffer) and returns either anormal completion containingunused or athrow completion. It performs the following steps when called:

  1. Letlen be ? LengthOfArrayLike(arrayLike).
  2. Perform ? AllocateTypedArrayBuffer(O,len).
  3. Letk be 0.
  4. Repeat, whilek <len,
    1. LetPk be ! ToString(𝔽(k)).
    2. LetkValue be ? Get(arrayLike,Pk).
    3. Perform ? Set(O,Pk,kValue,true).
    4. Setk tok + 1.
  5. Returnunused.

23.2.5.1.6 AllocateTypedArrayBuffer (O,length )

The abstract operation AllocateTypedArrayBuffer takes argumentsO (aTypedArray) andlength (a non-negativeinteger) and returns either anormal completion containingunused or athrow completion. It allocates and associates an ArrayBuffer withO. It performs the following steps when called:

  1. Assert:O.[[ViewedArrayBuffer]] isundefined.
  2. LetelementSize beTypedArrayElementSize(O).
  3. LetbyteLength beelementSize ×length.
  4. Letdata be ? AllocateArrayBuffer(%ArrayBuffer%,byteLength).
  5. SetO.[[ViewedArrayBuffer]] todata.
  6. SetO.[[ByteLength]] tobyteLength.
  7. SetO.[[ByteOffset]] to 0.
  8. SetO.[[ArrayLength]] tolength.
  9. Returnunused.

23.2.6 Properties of theTypedArray Constructors

EachTypedArrayconstructor:

  • has a[[Prototype]] internal slot whose value is%TypedArray%.
  • has a"length" property whose value is3𝔽.
  • has a"name" property whose value is the String value of theconstructor name specified for it inTable 73.
  • has the following properties:

23.2.6.1TypedArray.BYTES_PER_ELEMENT

The value ofTypedArray.BYTES_PER_ELEMENT is the Element Size value specified inTable 73 forTypedArray.

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:false }.

23.2.6.2TypedArray.prototype

The initial value ofTypedArray.prototype is the correspondingTypedArray prototype intrinsic object (23.2.7).

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:false }.

23.2.7 Properties of theTypedArray Prototype Objects

EachTypedArray prototype object:

  • has a[[Prototype]] internal slot whose value is%TypedArray.prototype%.
  • is anordinary object.
  • does not have a[[ViewedArrayBuffer]] or any other of the internal slots that are specific toTypedArray instance objects.

23.2.7.1TypedArray.prototype.BYTES_PER_ELEMENT

The value ofTypedArray.prototype.BYTES_PER_ELEMENT is the Element Size value specified inTable 73 forTypedArray.

This property has the attributes {[[Writable]]:false,[[Enumerable]]:false,[[Configurable]]:false }.

23.2.7.2TypedArray.prototype.constructor

The initial value of the"constructor" property of the prototype for a givenTypedArrayconstructor is theconstructor itself.

23.2.8 Properties ofTypedArray Instances

TypedArray instances areTypedArrays. EachTypedArray instance inherits properties from the correspondingTypedArray prototype object. EachTypedArray instance has the following internal slots:[[ViewedArrayBuffer]],[[TypedArrayName]],[[ContentType]],[[ByteLength]],[[ByteOffset]], and[[ArrayLength]].

23.3 Uint8Array Objects

A Uint8Array is a particular kind ofTypedArray as described above. In addition, there are additional methods on the Uint8Arrayconstructor (23.3.1) and on the Uint8Array prototype object (23.3.2).

23.3.1 Additional Properties of the Uint8Array Constructor

23.3.1.1 Uint8Array.fromBase64 (string [ ,options ] )

  1. Ifstringis not a String, throw aTypeError exception.
  2. Letopts be ? GetOptionsObject(options).
  3. Letalphabet be ? Get(opts,"alphabet").
  4. Ifalphabet isundefined, setalphabet to"base64".
  5. Ifalphabet is neither"base64" nor"base64url", throw aTypeError exception.
  6. LetlastChunkHandling be ? Get(opts,"lastChunkHandling").
  7. IflastChunkHandling isundefined, setlastChunkHandling to"loose".
  8. IflastChunkHandling is not one of"loose","strict", or"stop-before-partial", throw aTypeError exception.
  9. Letresult beFromBase64(string,alphabet,lastChunkHandling).
  10. Ifresult.[[Error]] is notnone, then
    1. ReturnThrowCompletion(result.[[Error]]).
  11. LetresultLength be the number of elements inresult.[[Bytes]].
  12. Letta be ? AllocateTypedArray("Uint8Array",%Uint8Array%,"%Uint8Array.prototype%",resultLength).
  13. Assert:ta.[[ViewedArrayBuffer]].[[ArrayBufferByteLength]] is the number of elements inresult.[[Bytes]].
  14. Set the value at each index ofta.[[ViewedArrayBuffer]].[[ArrayBufferData]] to the value at the corresponding index ofresult.[[Bytes]].
  15. Returnta.

23.3.1.2 Uint8Array.fromHex (string )

  1. Ifstringis not a String, throw aTypeError exception.
  2. Letresult beFromHex(string).
  3. Ifresult.[[Error]] is notnone, then
    1. ReturnThrowCompletion(result.[[Error]]).
  4. LetresultLength be the number of elements inresult.[[Bytes]].
  5. Letta be ? AllocateTypedArray("Uint8Array",%Uint8Array%,"%Uint8Array.prototype%",resultLength).
  6. Assert:ta.[[ViewedArrayBuffer]].[[ArrayBufferByteLength]] is the number of elements inresult.[[Bytes]].
  7. Set the value at each index ofta.[[ViewedArrayBuffer]].[[ArrayBufferData]] to the value at the corresponding index ofresult.[[Bytes]].
  8. Returnta.

23.3.2 Additional Properties of the Uint8Array Prototype Object

23.3.2.1 Uint8Array.prototype.setFromBase64 (string [ ,options ] )

  1. Letinto be thethis value.
  2. Perform ? ValidateUint8Array(into).
  3. Ifstringis not a String, throw aTypeError exception.
  4. Letopts be ? GetOptionsObject(options).
  5. Letalphabet be ? Get(opts,"alphabet").
  6. Ifalphabet isundefined, setalphabet to"base64".
  7. Ifalphabet is neither"base64" nor"base64url", throw aTypeError exception.
  8. LetlastChunkHandling be ? Get(opts,"lastChunkHandling").
  9. IflastChunkHandling isundefined, setlastChunkHandling to"loose".
  10. IflastChunkHandling is not one of"loose","strict", or"stop-before-partial", throw aTypeError exception.
  11. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(into,seq-cst).
  12. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
  13. LetbyteLength beTypedArrayLength(taRecord).
  14. Letresult beFromBase64(string,alphabet,lastChunkHandling,byteLength).
  15. Letbytes beresult.[[Bytes]].
  16. Letwritten be the number of elements inbytes.
  17. NOTE:FromBase64 does not invoke any user code, so the ArrayBuffer backinginto cannot have been detached or shrunk.
  18. Assert:writtenbyteLength.
  19. PerformSetUint8ArrayBytes(into,bytes).
  20. Ifresult.[[Error]] is notnone, then
    1. ReturnThrowCompletion(result.[[Error]]).
  21. LetresultObject beOrdinaryObjectCreate(%Object.prototype%).
  22. Perform ! CreateDataPropertyOrThrow(resultObject,"read",𝔽(result.[[Read]])).
  23. Perform ! CreateDataPropertyOrThrow(resultObject,"written",𝔽(written)).
  24. ReturnresultObject.

23.3.2.2 Uint8Array.prototype.setFromHex (string )

  1. Letinto be thethis value.
  2. Perform ? ValidateUint8Array(into).
  3. Ifstringis not a String, throw aTypeError exception.
  4. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(into,seq-cst).
  5. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
  6. LetbyteLength beTypedArrayLength(taRecord).
  7. Letresult beFromHex(string,byteLength).
  8. Letbytes beresult.[[Bytes]].
  9. Letwritten be the number of elements inbytes.
  10. NOTE:FromHex does not invoke any user code, so the ArrayBuffer backinginto cannot have been detached or shrunk.
  11. Assert:writtenbyteLength.
  12. PerformSetUint8ArrayBytes(into,bytes).
  13. Ifresult.[[Error]] is notnone, then
    1. ReturnThrowCompletion(result.[[Error]]).
  14. LetresultObject beOrdinaryObjectCreate(%Object.prototype%).
  15. Perform ! CreateDataPropertyOrThrow(resultObject,"read",𝔽(result.[[Read]])).
  16. Perform ! CreateDataPropertyOrThrow(resultObject,"written",𝔽(written)).
  17. ReturnresultObject.

23.3.2.3 Uint8Array.prototype.toBase64 ( [options ] )

  1. LetO be thethis value.
  2. Perform ? ValidateUint8Array(O).
  3. Letopts be ? GetOptionsObject(options).
  4. Letalphabet be ? Get(opts,"alphabet").
  5. Ifalphabet isundefined, setalphabet to"base64".
  6. Ifalphabet is neither"base64" nor"base64url", throw aTypeError exception.
  7. LetomitPadding beToBoolean(?Get(opts,"omitPadding")).
  8. LettoEncode be ? GetUint8ArrayBytes(O).
  9. Ifalphabet is"base64", then
    1. LetoutAscii be the sequence of code points which results from encodingtoEncode according to the base64 encoding specified in section 4 ofRFC 4648. Padding is included if and only ifomitPadding isfalse.
  10. Else,
    1. Assert:alphabet is"base64url".
    2. LetoutAscii be the sequence of code points which results from encodingtoEncode according to the base64url encoding specified in section 5 ofRFC 4648. Padding is included if and only ifomitPadding isfalse.
  11. ReturnCodePointsToString(outAscii).

23.3.2.4 Uint8Array.prototype.toHex ( )

  1. LetO be thethis value.
  2. Perform ? ValidateUint8Array(O).
  3. LettoEncode be ? GetUint8ArrayBytes(O).
  4. Letout be the empty String.
  5. For each bytebyte oftoEncode, do
    1. Lethex beNumber::toString(𝔽(byte), 16).
    2. Sethex toStringPad(hex, 2,"0",start).
    3. Setout to thestring-concatenation ofout andhex.
  6. Returnout.

23.3.3 Abstract Operations for Uint8Array Objects

23.3.3.1 ValidateUint8Array (ta )

The abstract operation ValidateUint8Array takes argumentta (anECMAScript language value) and returns either anormal completion containingunused or athrow completion. It performs the following steps when called:

  1. Perform ? RequireInternalSlot(ta,[[TypedArrayName]]).
  2. Ifta.[[TypedArrayName]] is not"Uint8Array", throw aTypeError exception.
  3. Returnunused.

23.3.3.2 GetUint8ArrayBytes (ta )

The abstract operation GetUint8ArrayBytes takes argumentta (a Uint8Array) and returns either anormal completion containing aList ofbyte values or athrow completion. It performs the following steps when called:

  1. Letbuffer beta.[[ViewedArrayBuffer]].
  2. LettaRecord beMakeTypedArrayWithBufferWitnessRecord(ta,seq-cst).
  3. IfIsTypedArrayOutOfBounds(taRecord) istrue, throw aTypeError exception.
  4. Letlen beTypedArrayLength(taRecord).
  5. LetbyteOffset beta.[[ByteOffset]].
  6. Letbytes be a new emptyList.
  7. Letindex be 0.
  8. Repeat, whileindex <len,
    1. LetbyteIndex bebyteOffset +index.
    2. Letbyte be(GetValueFromBuffer(buffer,byteIndex,uint8,true,unordered)).
    3. Appendbyte tobytes.
    4. Setindex toindex + 1.
  9. Returnbytes.

23.3.3.3 SetUint8ArrayBytes (into,bytes )

The abstract operation SetUint8ArrayBytes takes argumentsinto (a Uint8Array) andbytes (aList ofbyte values) and returnsunused. It performs the following steps when called:

  1. Letoffset beinto.[[ByteOffset]].
  2. Letlen be the number of elements inbytes.
  3. Letindex be 0.
  4. Repeat, whileindex <len,
    1. Letbyte bebytes[index].
    2. LetbyteIndexInBuffer beindex +offset.
    3. PerformSetValueInBuffer(into.[[ViewedArrayBuffer]],byteIndexInBuffer,uint8,𝔽(byte),true,unordered).
    4. Setindex toindex + 1.
  5. Returnunused.

23.3.3.4 SkipAsciiWhitespace (string,index )

The abstract operation SkipAsciiWhitespace takes argumentsstring (a String) andindex (a non-negativeinteger) and returns a non-negativeinteger. It performs the following steps when called:

  1. Letlength be the length ofstring.
  2. Repeat, whileindex <length,
    1. Letchar be the code unit at indexindex withinstring.
    2. Ifchar is not one of 0x0009 (TAB), 0x000A (LF), 0x000C (FF), 0x000D (CR), or 0x0020 (SPACE), then
      1. Returnindex.
    3. Setindex toindex + 1.
  3. Returnindex.

23.3.3.5 DecodeFinalBase64Chunk (chunk,throwOnExtraBits )

The abstract operation DecodeFinalBase64Chunk takes argumentschunk (a String of length 2 or 3) andthrowOnExtraBits (a Boolean) and returns either anormal completion containing aList ofbyte values, or athrow completion. It performs the following steps when called:

  1. LetchunkLength be the length ofchunk.
  2. IfchunkLength = 2, then
    1. Setchunk to thestring-concatenation ofchunk and"AA".
  3. Else,
    1. Assert:chunkLength is 3.
    2. Setchunk to thestring-concatenation ofchunk and"A".
  4. Letbytes beDecodeFullLengthBase64Chunk(chunk).
  5. IfchunkLength = 2, then
    1. IfthrowOnExtraBits istrue andbytes[1] ≠ 0, then
      1. Throw aSyntaxError exception.
    2. Return «bytes[0] ».
  6. Else,
    1. IfthrowOnExtraBits istrue andbytes[2] ≠ 0, then
      1. Throw aSyntaxError exception.
    2. Return «bytes[0],bytes[1] ».

23.3.3.6 DecodeFullLengthBase64Chunk (chunk )

The abstract operation DecodeFullLengthBase64Chunk takes argumentchunk (a String of length 4) and returns aList ofbyte values of length 3.

Thestandard base64 alphabet is"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i.e., the String whose elements are the code units corresponding to every letter and number in the Unicode Basic Latin block along with"+" and"/".

  1. LetbyteSequence be the unique sequence of 3 bytes resulting from decodingchunk as base64 (i.e., the sequence such that applying the base64 encoding specified in section 4 ofRFC 4648 tobyteSequence would producechunk).
  2. Return aList whose elements are the elements ofbyteSequence, in order.

23.3.3.7 FromBase64 (string,alphabet,lastChunkHandling [ ,maxLength ] )

The abstract operation FromBase64 takes argumentsstring (a String),alphabet ("base64" or"base64url"), andlastChunkHandling ("loose","strict", or"stop-before-partial") and optional argumentmaxLength (a non-negativeinteger) and returns aRecord with fields[[Read]] (aninteger),[[Bytes]] (aList ofbyte values), and[[Error]] (aSyntaxError object ornone). It performs the following steps when called:

  1. IfmaxLength is not present, then
    1. SetmaxLength to 253 - 1.
    2. NOTE: Because the inputis a String, the length of Strings is limited to 253 - 1 characters, and the output requires no more bytes than the input has characters, this limit can never be reached. However, it is editorially convenient to use afinite value formaxLength.
  2. NOTE: The order of validation and decoding in the algorithm below is not observable. Implementations are encouraged to perform them in whatever order is most efficient, possibly interleaving validation with decoding.
  3. IfmaxLength = 0, then
    1. Return theRecord {[[Read]]: 0,[[Bytes]]: « »,[[Error]]:none }.
  4. Letread be 0.
  5. Letbytes be a new emptyList.
  6. Letchunk be the empty String.
  7. LetchunkLength be 0.
  8. Letindex be 0.
  9. Letlength be the length ofstring.
  10. Repeat,
    1. Setindex toSkipAsciiWhitespace(string,index).
    2. Ifindex =length, then
      1. IfchunkLength > 0, then
        1. IflastChunkHandling is"stop-before-partial", then
          1. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:none }.
        2. Else iflastChunkHandling is"loose", then
          1. IfchunkLength = 1, then
            1. Leterror be a newly createdSyntaxError object.
            2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
          2. Setbytes to thelist-concatenation ofbytes and ! DecodeFinalBase64Chunk(chunk,false).
        3. Else,
          1. Assert:lastChunkHandling is"strict".
          2. Leterror be a newly createdSyntaxError object.
          3. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
      2. Return theRecord {[[Read]]:length,[[Bytes]]:bytes,[[Error]]:none }.
    3. Letchar be thesubstring ofstring fromindex toindex + 1.
    4. Setindex toindex + 1.
    5. Ifchar is"=", then
      1. IfchunkLength < 2, then
        1. Leterror be a newly createdSyntaxError object.
        2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
      2. Setindex toSkipAsciiWhitespace(string,index).
      3. IfchunkLength = 2, then
        1. Ifindex =length, then
          1. IflastChunkHandling is"stop-before-partial", then
            1. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:none }.
          2. Leterror be a newly createdSyntaxError object.
          3. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
        2. Setchar to thesubstring ofstring fromindex toindex + 1.
        3. Ifchar is"=", then
          1. Setindex toSkipAsciiWhitespace(string,index + 1).
      4. Ifindex <length, then
        1. Leterror be a newly createdSyntaxError object.
        2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
      5. IflastChunkHandling is"strict", letthrowOnExtraBits betrue; otherwise letthrowOnExtraBits befalse.
      6. LetdecodeResult beCompletion(DecodeFinalBase64Chunk(chunk,throwOnExtraBits)).
      7. IfdecodeResult is anabrupt completion, then
        1. Leterror bedecodeResult.[[Value]].
        2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
      8. Setbytes to thelist-concatenation ofbytes and ! decodeResult.
      9. Return theRecord {[[Read]]:length,[[Bytes]]:bytes,[[Error]]:none }.
    6. Ifalphabet is"base64url", then
      1. Ifchar is either"+" or"/", then
        1. Leterror be a newly createdSyntaxError object.
        2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
      2. Else ifchar is"-", then
        1. Setchar to"+".
      3. Else ifchar is"_", then
        1. Setchar to"/".
    7. If the sole code unit ofchar is not an element of thestandard base64 alphabet, then
      1. Leterror be a newly createdSyntaxError object.
      2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
    8. Letremaining bemaxLength - the number of elements inbytes.
    9. Ifremaining = 1 andchunkLength = 2, or ifremaining = 2 andchunkLength = 3, then
      1. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:none }.
    10. Setchunk to thestring-concatenation ofchunk andchar.
    11. SetchunkLength to the length ofchunk.
    12. IfchunkLength = 4, then
      1. Setbytes to thelist-concatenation ofbytes andDecodeFullLengthBase64Chunk(chunk).
      2. Setchunk to the empty String.
      3. SetchunkLength to 0.
      4. Setread toindex.
      5. If the number of elements inbytes =maxLength, then
        1. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:none }.

23.3.3.8 FromHex (string [ ,maxLength ] )

The abstract operation FromHex takes argumentstring (a String) and optional argumentmaxLength (a non-negativeinteger) and returns aRecord with fields[[Read]] (aninteger),[[Bytes]] (aList ofbyte values), and[[Error]] (aSyntaxError object ornone). It performs the following steps when called:

  1. IfmaxLength is not present, setmaxLength to 253 - 1.
  2. Letlength be the length ofstring.
  3. Letbytes be a new emptyList.
  4. Letread be 0.
  5. Iflengthmodulo 2 ≠ 0, then
    1. Leterror be a newly createdSyntaxError object.
    2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
  6. Repeat, whileread <length and the number of elements inbytes <maxLength,
    1. Lethexits be thesubstring ofstring fromread toread + 2.
    2. Ifhexits contains any code units which are not in"0123456789abcdefABCDEF", then
      1. Leterror be a newly createdSyntaxError object.
      2. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:error }.
    3. Setread toread + 2.
    4. Letbyte be theinteger value represented byhexits in base-16 notation, using the lettersA throughF anda throughf for digits with values 10 through 15.
    5. Appendbyte tobytes.
  7. Return theRecord {[[Read]]:read,[[Bytes]]:bytes,[[Error]]:none }.

[8]ページ先頭

©2009-2025 Movatter.jp