Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

await async 中如何做到并行处理?

$
0
0

例如:

function  getName(name){
  return Promise(function(){
    resolve(name + '123');
  });
}
(async ()=>{
var res = [];
for(const name of names){
   res[name] = await getName(name);
}
})();


Viewing all articles
Browse latest Browse all 14821

Trending Articles