我一直在试图弄清楚。如何将结果从 Promise 循环推送到数组。谁能指出我正确的位置?
const ids = [1, 2, 3]
let results = []
for (let id of ids) {
getLight(id)
.then(light => {
results.push(light)
})
.catch(err => {
console.log(err)
})
}