I have a promise which is supposed to be resolved with an array. Each element of the resulting array is a result of a lengthy asynchronous operation itself, similar to this:
new Promise(resolve, reject) {
const arr = [param1, param2, param3];
const resultArr = [];
async function foo(param) { return await ... };
arr.forEach(param) {
resultArr.push(foo(param));
}
resolve(resultArr);
}
The code above resolves with an array of unresolved promises, instead of actual values.