A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/Symbol.species below:

get Array[@@species] - JavaScript | MDN

get Array[@@species]

Baseline Widely available

La propiedad de acceso Array[@@species] devuelve el constructor de Array.

Sintaxis Valor de retorno

El constructor Array.

Descripción

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.

Ejemplos

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