GUIPSS

Cool code : concurrent async calls

Posted on: 2018-08-23
Categories: javascript - es6
var myAsyncFunc = async function () {
  const [ a, b ] = await Promise.all([ promiseFunc1(), promiseFunc2() ]);
  // the two calls are made at the same time, and we get back two variable
  // that can be used right away :
  console.log(a);
  console.log(b);
}