Intro to Generator functions

added by JavaScript Kicks
4/11/2019 7:16:10 AM

229 Views

Generator function is a function that can pause, accept some input and run again. Consider the printHello function which returns "Hello world" function* printHello() { yield 'Hello world'; } When a function has an asterix (*) as suffix, it becomes a generator function. How do we invoke a generator function?


0 comments