📜  javascript 生成器函数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:55.843000             🧑  作者: Mango

代码示例2
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