You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
%TypedArray%.of uses the this value as the constructor, not this[Symbol.species]. This seems inconsistent with the methods on %TypedArrayPrototype% like subarray and slice.
The text was updated successfully, but these errors were encountered:
No, it's correct as written and handled exactly the same as in %Array%.of
of is a factory method of the constructor so the actual class constructor to be instantiated is the thisValue passed to the factory. What the algorithm is doing is approximately this:
When used in an expression referencing a subclass such as Int32Array.of(1,2,3) the value of this within the inherited method will be %Int32Array%. Essentially the expression is explicitly naming the kind of typed array it wants to instantiate.
@@species is primarily for use in instance methods that create derived collections whose class isn't explicit stated at the usage site.
%TypedArray%.of uses the this value as the constructor, not
this[Symbol.species]
. This seems inconsistent with the methods on %TypedArrayPrototype% like subarray and slice.The text was updated successfully, but these errors were encountered: