JavaScript MCQ Javascript Functions MCQ Question #4877
Single Choice Not Set

QWhat is a generator function in JavaScript?

ID: #4877 Javascript Functions MCQ 209 views
Question Info
#4877Q ID
Not SetDifficulty
Javascript Functions MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A A function that returns an iterator
  • B A function that yields a value
  • C A function that does both of the above
  • D None of these
Correct Answer

Explanation

A generator function is a function that returns an iterator and can yield a value multiple times.
Generator functions are denoted by the * symbol and can be paused and resumed at any time.
They are often used to create asynchronous code that is easier to read and maintain.

Share This Question

Challenge a friend or share with your study group.