在将它们的 return 数据用于另一个函数调用之前,如何等待多个承诺全部完成?

How can I wait for multiple promises to all be done before using their return data for another function call?

除非我弄错了,否则我想从 3 个不同的承诺中获取值并使用它们 return 来调用一个函数。我尝试查看链接承诺和 Promise.all,但我认为这不能解决我正在寻找的问题?

我想做的是这样的:

somePromise( someParam ) => ( someReturnObj1 => {

});

somePromise2( someParam ) => ( someReturnObj2 => {

});

somePromise3( someParam ) => ( someReturnObj3 => {

});

// I would like to call this after getting all the data from those 3 promises
callSomeFunc( someReturnObj1, someReturnObj2, someReturnObj3 );

这可能吗?

试试这个:

Promise.all([promise1,promise2]).then(result => {
    resultFromPromise1 = result[0];
    resultFromPromise2 = result[1];
});