Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #Generators
ADD COMMENT
Topic
Name
2+5 =