for example
Promis.all([p1,p2]).then((p1result,p2result)=>{});
if p1 returns [1mem2p3]
p2 returns [4mage5magin6]
the final result is a parameter [1mem2magin3], what should I do if I want to use the results of two p objects respectively?
for example
Promis.all([p1,p2]).then((p1result,p2result)=>{});
if p1 returns [1mem2p3]
p2 returns [4mage5magin6]
the final result is a parameter [1mem2magin3], what should I do if I want to use the results of two p objects respectively?
means you don't understand. The result is not p1result
, p2result
? Just use it
Promise.all ()
also returns a common promise
, promise
will only have one value, but this value is an array;
according to your description, it should not be the that you said.
var p1 = Promise.resolve([1,2]);
var p2 = Promise.resolve([3,4]);
Promise.all([p1,p2]).then(console.log)
//> [Array(2), Array(2)]