js yield*
function* g1() {
yield 2;
yield 3;
yield 4;
}
function* g2() {
yield 1;
yield* g1();
yield 5;
}
const iterator = g2();
console.log(iterator.next()); // {value: 1, done: false}
console.log(iterator.next()); // {value: 2, done: false}
console.log(iterator.next()); // {value: 3, done: false}
console.log(iterator.next()); // {value: 4, done: false}
console.log(iterator.next()); // {value: 5, done: false}
console.log(iterator.next()); // {value: undefined, done: true}
Also in JavaScript:
- js import and export
- react render for loop
- javascript remove object key
- how to check the extension of a file in javascript
- how to push mutual array elements in an array nested loop javascript
- how to reload page on button click in javascript
- jquery get ip
- how to make a vertical array js
- convert camelcase to sentence case javascript
- javascript how to raise the error
- angular interview questions
- badlion client
- formating decimal hours as hours and minute javascript
- object destructuring into this
- js url encode
- javascript stringify an object
- javascript print
- javascript genreate number id
- js array.pop
- server info discord.js
- how to run a vue js hello world app in vue version 3
- form taglib in jsp
- javascript get index
- javascript turn string into array