Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generator function javascript


function* expandSpan(xStart, xLen, yStart, yLen) {
    const xEnd = xStart + xLen;
    const yEnd = yStart + yLen;
    for (let x = xStart; x < xEnd; ++x) {
         for (let y = yStart; y < yEnd; ++y) {
            yield {x, y};
        }
    }
} 


//this is code from my mario game I dont think this code is functional
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #generator #function #javascript
ADD COMMENT
Topic
Name
5+4 =