In this exercise, create a numbers object that is iterable. This iterable object should be able to iterate one by one through a set of numbers, or step through the numbers at a custom interval. The code for this exercise is in the ex5.js file.
- Here's our exercise.…You're gonna get to do almost exactly what we just did…but in a slightly more sophisticated way, k?…Question, where is the next call?…It is inside of…the dot, dot, dot iterator…or inside of the for of loop.…The dot, dot, dot iterator and the for of loop…automatically consume an iterator until its completion.…So, they automatically loop over it…and call the dot next call…and pull out its value and all that stuff for you.…
- [Man] So, if you accidentally did that…on something that never stopped generating…you'd have a stack overflow real fast?…- Yip, that's exactly right.…If you called a dot, dot, dot on a wild true generator,…you're gonna lock up your program,…it's gonna go forever, k?…Exercise five.…I want you to define a numbers object…that is iterable,…and by default…it should start at position…or at the value at the number zero,…going by ones…up to and including 100.…
But I also want it to be able…to make my own custom iterator…which can customize where to start,…what increment to use,…and where to end.…
This course was created by Frontend Masters. It was originally released on 01/10/2017. We're pleased to host this training in our library.
- The arrow function
- Arrow function variations
- Closures and explicit blocks
- Default values
- Using the gather and spread operators
- Dumping variables
- Concise properties and methods
- Symbols, iterators, and generators
- Optimizing codes for the reader
Skill Level Intermediate
1. Arrow Functions
2. Block Scope
3. Default Values and the Gather/Spread Operators
5. Template Strings
6. Symbols, Iterators, and Generators
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.