The Array[Symbol.species]
static accessor property returns the constructor used to construct return values from array methods.
Warning:
The existence of [Symbol.species]
allows execution of arbitrary code and may create security vulnerabilities. It also makes certain optimizations much harder. Engine implementers are investigating whether to remove this feature. Avoid relying on it if possible. Modern array methods, such as toReversed()
, do not use [Symbol.species]
and always return a new Array
base class instance.