Lesson

Write a Generator Function to Generate the Alphabet

When you need to generate a data set, a generator function is often the correct solution. A generator function is defined with function and then you yield each result you want out of the function when you call it. Generators pair well with the ... operator...

Duration
2 min
Access
Free
Transcript
Available

When you need to generate a data set, a generator function is often the correct solution. A generator function is defined with function* and then you yield each result you want out of the function when you call it. Generators pair well with the ... operator inside of Array because they serve as iterators which can be called until all their results are exhausted.