Answers for "JavaScript — Generators"

1

generators in javascript

function* g(){    //or function *g(){}
  console.log("First");
  yield 1;
  console.log("second");
   yield 2;
  console.log("third");
} 
let generator=g();
generator.next();
generator.next();
Posted by: Guest on August-09-2020
0

function generator js

function* name([param[, param[, ... param]]]) {
   statements
}
Posted by: Guest on July-27-2020
-1

JavaScript — Generators

function* makeRangeIterator(start = 0, end = 100, step = 1) {
    let iterationCount = 0;
    for (let i = start; i < end; i += step) {
        iterationCount++;
        yield i;
    }
    return iterationCount;
}
Posted by: Guest on November-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language