Created
May 20, 2018 13:05
-
-
Save nairihar/b63940a6398c46560e9b0ffd8a2164cd to your computer and use it in GitHub Desktop.
Symbol iterator, Async Iterator in NodeJS v10, medium
This file contains hidden or 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
const arr = [4, 5, 6]; // iterable object | |
const iterator = arr[Symbol.iterator](); | |
console.log(iterator.next()); // {value: 4, done: false} | |
console.log(iterator.next()); // {value: 5, done: false} | |
console.log(iterator.next()); // {value: 6, done: false} | |
console.log(iterator.next()); // {value: undefined, done: true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment