Transcript from the "Computed Generator Methods" Lesson
>> Kyle Simpson: So let's try to make this a little more concrete, let's come back to our example here. And let's think about how would we make this OBJ object iterable. Well I do need a symbol iterator here, right. But pretty much almost all of this stuff goes away.
>> Kyle Simpson: That's a good start.
[00:00:25] [LAUGH] Right. Now we want our symbol iterator to produce an iterator. What data type did we just find out automatically produces iterators? Generator. So let's do a concise computed generator method, okay. Now, this thing needs to simply spit out values. Here's what it's gonna do for var (i = this.start; i less than or equal to this.end,
>> Kyle Simpson: i++) Yield this stock values of [i].
>> Kyle Simpson: Gone.
>> Kyle Simpson: Think about what that's doing now. It's producing an iterator that is going to start at this .start location. Loop over its values array. And just yield out whatever it finds in that values array.
>> Kyle Simpson: I'm pretty sure if I was hard pressed I would have to tell you generator is either my favorite or my second favorite feature.
[00:01:58] It's a tie between generators and destructuring terms of my favorite, most powerful features. They have high learning curves, they have huge payoffs.
[00:02:37] My on in my actual unofficial answer to that question is because they generate value. [INAUDIBLE] But I don't know if that's the real reason they're called generators.