Skip to content

Instantly share code, notes, and snippets.

@DaveBitter
Created February 4, 2022 14:07
Show Gist options
  • Save DaveBitter/6519e645c19e8f099d0a7284fd22a9ca to your computer and use it in GitHub Desktop.
Save DaveBitter/6519e645c19e8f099d0a7284fd22a9ca to your computer and use it in GitHub Desktop.
(async () => {
const promiseA = new Promise((resolve, reject) => {
setTimeout(() => {
resolve({data: 'dataA', error: 'errorA'});
}, 2000);
})
const promiseB = new Promise((resolve, reject) => {
setTimeout(() => {
resolve({data: 'dataB', error: 'errorB'});
}, 2000);
});
const result = await Promise.all([promiseA, promiseB]);
console.log(result);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment