Last active
April 26, 2017 04:57
-
-
Save devmobasa/f18322fb0b4435dbf4f48ab0c0d232c2 to your computer and use it in GitHub Desktop.
JavaScript Iterators - Array - Coding Blast - www.codingblast.com
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
| let numbers = [1, 2, 3]; | |
| let it = numbers[Symbol.iterator](); | |
| console.log(it.next()); // {value: 1, done: false} | |
| console.log(it.next()); // {value: 2, done: false} | |
| console.log(it.next()); // {value: 3, done: false} | |
| console.log(it.next()); // {value: undefined, done: true} | |
| for (let num of numbers) { | |
| console.log(num); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment