Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```js
- function* producer() {
- let index = 0;
- while (1)
- yield index++;
- }
- let consumer = () => {
- let data = producer();
- console.log(data.next().value); // 0
- console.log(data.next().value); // 1
- console.log(data.next().value); // 2
- console.log(data.next().value); // 3
- }
Add Comment
Please, Sign In to add comment