Get to know MDN better
Esta página ha sido traducida del inglés por la comunidad. Aprende más y únete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since septiembre de 2016.
El método next() regresa un objeto con las propiedades done y value. También puedes pasar un parámetro al método next para enviar un valor al generador.
El valor a enviar al generador.
Un Object con dos propiedades:
done (booleano)
value - cualquier valor Javascript regresado por el iterador. Éste puede ser omitido si done is verdadero.
The following example shows a simple generator and the object that the next method returns:
In this example, next is called with a value. Note that the first call did not log anything, because the generator was not yielding anything initially.
| ECMAScript® 2027 Language Specification # sec-generator.prototype.next |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 24 jun 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.