Baseline Widely available
La propiedad de acceso Array[@@species]
devuelve el constructor de Array
.
El constructor Array
.
La propiedad de acceso species
devuelve el constructor predeterminado para objetos Array
. Los constructores de subclase pueden anularlo para cambiar la asignación del constructor.
La propiedad species
devuelve la función de constructor predeterminada, que es el constructor Array
para objetos Array
:
Array[Symbol.species]; // function Array()
In a derived collection object (e.g. your custom array MyArray
), the MyArray
species is the MyArray
constructor. However, you might want to overwrite this, in order to return parent Array
objects in your derived class methods:
class MyArray extends Array {
// Overwrite MyArray species to the parent Array constructor
static get [Symbol.species]() {
return Array;
}
}
Especificaciones Compatibilidad con navegadores Ver también
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4