📜  将 promise 转换为生成器 js - Javascript 代码示例

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

代码示例2
function count(n){
  var res = []
  for (var x = 0; x < n; x++) {
    res.push(x)
  }
  return res
}

for (var x of count(5)) {
  console.log(x)
}