ES6 (ES2015) - Generators

InstructorJohn Lindquist

Share this video with your friends

Send Tweet

Generators in ECMAscript 6 are first-class coroutines that produce encapsulated suspended execution contexts. Whew! Yield values and iterate over them until no more values exist in the generator. We'll talk more about practical use later ;)

Saiful
~ 9 years ago

This may sound off topic, but up until this video, i've noticed that ecma script 6 looks a lot like python.. any reason or story behind it?

James
~ 9 years ago

I was following along with the ES6 lessons nicely up to this one. Then........wat?

Bress B
~ 8 years ago

John Lindquist mentions there will be follow up lessons on practical use cases of Generators. I realize there are whole courses on RxJS, etc but can we see some practical uses of Generators soon?

James
~ 8 years ago

John Lindquist mentions there will be follow up lessons on practical use cases of Generators. I realize there are whole courses on RxJS, etc but can we see some practical uses of Generators soon?

I'm wondering the same thing. There is an RxJS Observables + Generators lesson by Mr. CycleJS.

Michael Hueter
~ 8 years ago

I was following along with the ES6 lessons nicely up to this one. Then........wat?

same

James Bedont
~ 8 years ago

lost the thread of the course on this video. I really could have used some sort of practical example of generators.

Joel Hooks
~ 8 years ago

lost the thread of the course on this video. I really could have used some sort of practical example of generators.

Hey James, generators had me scratching my head for a practical use for a long time. Then I saw them used for redux-sagas. Mind blown! http://joelhooks.com/blog/2016/03/20/build-an-image-gallery-using-redux-saga

DANIEL Pride
~ 7 years ago

Please fix this sound. Twelve is very low volume, then when you come into thirteen it blows your eardrums out !!!

Chris Pauley
~ 7 years ago

I would also like to see practical use cases of generators.

Gabriel
~ 7 years ago

At 4:38, when I called the first next with a string, it didn't throw a TypeError for me.

CrazyFunker
~ 7 years ago

does anyone have a link to his aforementioned 'practical uses' video? cheers

Alex
~ 6 years ago

there's a course for generators you might like to watch https://egghead.io/courses/write-simple-asynchronous-code-with-javascript-generators

CrazyFunker
~ 6 years ago

there's a course for generators you might like to watch https://egghead.io/courses/write-simple-asynchronous-code-with-javascript-generators

Thanks Alex!

Reinart Geronimo
~ 6 years ago

I agree with many of the comments above that this chapter is missing information on practical use cases for generators.

Marek Zeman
~ 6 years ago

Finally a simple explanation of generators. So far I was just confused about the logic and usage. Thanks!