IB
Size: a a a
IB
S
S
S
S
IB
function promiseAll(promises) {
return new Promise((res, rej) => {
const results = new Array(promises.length);
if(promises.length === 0 ) res(results)
let counter = 0;
promises.forEach((promise, index) => {
promise
.then((data) => {
results[index] = data;
if (++counter === promises.length) res(results);
})
.catch(rej);
});
});
}
S
S
S
IB
S
S
S
S
S
S
ei
OT
OT