-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert /web/javascript/reference/global_objects/array folder to Mark…
…down (es) (#8169) * Convert /web/javascript/reference/global_objects/array folder to Markdown (es) * Apply suggestions from code review Authored by: Queen Vinyl Da.i'gyu-Kazotetsu <[email protected]> Co-authored-by: GrayWolf <[email protected]>
- Loading branch information
Showing
58 changed files
with
3,835 additions
and
4,442 deletions.
There are no files selected for viewing
90 changes: 0 additions & 90 deletions
90
files/es/web/javascript/reference/global_objects/array/@@iterator/index.html
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
files/es/web/javascript/reference/global_objects/array/@@iterator/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
title: Array.prototype[@@iterator]() | ||
slug: Web/JavaScript/Reference/Global_Objects/Array/@@iterator | ||
tags: | ||
- Array | ||
- ECMAScript 2015 | ||
- Iterator | ||
- JavaScript | ||
- Prototipo | ||
- Referencia | ||
- metodo | ||
translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@iterator | ||
original_slug: Web/JavaScript/Referencia/Objetos_globales/Array/@@iterator | ||
--- | ||
{{JSRef}} | ||
|
||
El valor inicial de la propiedad **`@@iterator`** es el mismo objeto de función que el valor inicial de la propiedad {{jsxref("Array.prototype.values()", "values()")}}. | ||
|
||
## Sintaxis | ||
|
||
arr[Symbol.iterator]() | ||
|
||
### Valor de retorno | ||
|
||
El valor inicial dado por el **iterador** {{jsxref("Array.prototype.values()", "values()")}}. Por defecto, usar `arr[Symbol.iterator]` devolverá la función {{jsxref("Array.prototype.values()", "values()")}}. | ||
|
||
## Ejemplos | ||
|
||
### Iteración usando el bucle `for...of` | ||
|
||
```js | ||
var arr = ['w', 'y', 'k', 'o', 'p']; | ||
var eArr = arr[Symbol.iterator](); | ||
// nuestro navegador debe ser compatible con el bucle for..of | ||
// y variables let-scoped en bucles for | ||
for (let letter of eArr) { | ||
console.log(letter); | ||
} | ||
``` | ||
|
||
### Iteración alternativa | ||
|
||
```js | ||
var arr = ['w', 'y', 'k', 'o', 'p']; | ||
var eArr = arr[Symbol.iterator](); | ||
console.log(eArr.next().value); // w | ||
console.log(eArr.next().value); // y | ||
console.log(eArr.next().value); // k | ||
console.log(eArr.next().value); // o | ||
console.log(eArr.next().value); // p | ||
``` | ||
|
||
## Especificaciones | ||
|
||
| Especificación | Estado | Comentario | | ||
| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | -------------------- | | ||
| {{SpecName('ES2015', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}} | {{Spec2('ES2015')}} | Definición inicial.. | | ||
| {{SpecName('ESDraft', '#sec-array.prototype-@@iterator', 'Array.prototype[@@iterator]()')}} | {{Spec2('ESDraft')}} | | | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat("javascript.builtins.Array.@@iterator")}} | ||
|
||
## Ver también | ||
|
||
- {{jsxref("Array.prototype.keys()")}} | ||
- {{jsxref("Array.prototype.entries()")}} | ||
- {{jsxref("Array.prototype.forEach()")}} | ||
- {{jsxref("Array.prototype.every()")}} | ||
- {{jsxref("Array.prototype.some()")}} | ||
- {{jsxref("Array.prototype.values()")}} |
77 changes: 0 additions & 77 deletions
77
files/es/web/javascript/reference/global_objects/array/@@species/index.html
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
files/es/web/javascript/reference/global_objects/array/@@species/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: get Array[@@species] | ||
slug: Web/JavaScript/Reference/Global_Objects/Array/@@species | ||
tags: | ||
- Array | ||
- JavaScript | ||
- Prototipo | ||
- metodo | ||
translation_of: Web/JavaScript/Reference/Global_Objects/Array/@@species | ||
original_slug: Web/JavaScript/Referencia/Objetos_globales/Array/@@species | ||
--- | ||
{{JSRef}} | ||
|
||
La propiedad de acceso **`Array[@@species]`** devuelve el constructor de `Array`. | ||
|
||
## Sintaxis | ||
|
||
Array[Symbol.species] | ||
|
||
### Valor de retorno | ||
|
||
El constructor {{jsxref("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`: | ||
|
||
```js | ||
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: | ||
|
||
```js | ||
class MyArray extends Array { | ||
// Overwrite MyArray species to the parent Array constructor | ||
static get [Symbol.species]() { return Array; } | ||
} | ||
``` | ||
|
||
## Especificaciones | ||
|
||
| Especificación | Estado | Comentario | | ||
| -------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------------- | | ||
| {{SpecName('ES6', '#sec-get-array-@@species', 'get Array [ @@species ]')}} | {{Spec2('ES6')}} | Definición inicial. | | ||
| {{SpecName('ESDraft', '#sec-get-array-@@species', 'get Array [ @@species ]')}} | {{Spec2('ESDraft')}} | | | ||
|
||
## Compatibilidad con navegadores | ||
|
||
{{Compat("javascript.builtins.Array.@@species")}} | ||
|
||
## Ver también | ||
|
||
- {{jsxref("Array")}} | ||
- {{jsxref("Symbol.species")}} |
79 changes: 0 additions & 79 deletions
79
files/es/web/javascript/reference/global_objects/array/@@unscopables/index.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.