Arvind Yadav
What is generator in JS?

What is generator in JS?

By Arvind Yadav in JavaScript on Mar 23 2022
  • Rajkiran Swain
    Apr, 2023 3

    In JavaScript, a generator is a special kind of function that can pause its execution and resume it later. It allows you to write asynchronous code that looks synchronous, making it easier to reason about and understand.

    Generators are defined using the function* syntax, and they use the yield keyword to pause and resume their execution. When a generator is called, it returns an iterator, which can be used to control the execution of the generator.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS