JavaScript Generators in 7 Minutes: What They Are and How They're the Overpowered Iterator

Опубликовано: 22 Март 2026
на канале: Ijemma Onwuzulike
1,689
143

Generators are a level up from iterators. Not only can they be used to make non-iterable objects in JavaScript iterable, but they can also serve as a standalone iterable. This duality provides a lot of flexibility for developers on how and where they can create iterable objects throughout their applications.

In this video, I'll walk you through the basics of generators by showing you how they can work as both iterators and iterables. I'll show you how to create generators by using generator functions.

If you're not too familiar with the concept of iterators, pause this video and watch my video on iterators to get caught up:    • JavaScript Iterators Explained with Exampl...  

🎬 Subscribe to the channel! -    / @ijemmaonwuzulike  

Timestamps:
0:00 Intro
0:27 What are Generators?
1:35 Generator Functions and Generators as Iterables
3:42 Again, A Generator as an Iterable
4:45 Generators as Iterators
6:07 Benefits of Generators - Less Code!

== Let's Connect ==
🐦 Twitter -   / ijemmaohno  

== Who I Am ==
I'm Ijemma, a frontend software engineer currently working in New York City. I make videos on all things JavaScript and, more broadly, frontend web development.

#javascript #webdevelopment #softwareengineer