【发布时间】:2017-06-15 05:36:05
【问题描述】:
大家好,我想兑现我的承诺。
【问题讨论】:
-
你在哪里
return objects- 当然,它将是一个空数组,因为需要完成异步代码才能添加到objects
标签: javascript json node.js promise
大家好,我想兑现我的承诺。
【问题讨论】:
return objects - 当然,它将是一个空数组,因为需要完成异步代码才能添加到objects
标签: javascript json node.js promise
在第一个代码块中尝试以下操作
getUrls('https://json', 25, true)
.then((result) => {
return Promise.all(result.map(url => getJSONObject(url)));
}).then((objects) => {
console.log(objects); // issue just shows empty []
});
【讨论】: