Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Array[Symbol.species]

2 tags 1 category

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.

The [Symbol.species] accessor property returns the default constructor for Array objects. Subclass constructors may override it to change the constructor assignment. The default implementation is basically:

Syntax example: Array[Symbol.species]

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…