Generators in JavaScript

added by JavaScript Kicks
9/25/2018 8:39:45 AM

480 Views

We all know that a function in JavaScript runs in a top down fashion. For example in the following code: function sayHello() { console.log("Hello"); console.log("Hi There!!");}sayHello(); This provides the following output. Generator functions allow you to pause a function and resume a function. So with this you can suspend a function in between and do something else.


0 comments