Skip to content

Instantly share code, notes, and snippets.

@amakhrov
Last active August 29, 2018 03:17
Show Gist options
  • Save amakhrov/8d9578c5e228c16f2e85ef73347fca75 to your computer and use it in GitHub Desktop.
Save amakhrov/8d9578c5e228c16f2e85ef73347fca75 to your computer and use it in GitHub Desktop.
Promises - parallel
const asyncA = () => Promise.resolve('A');
const asyncB = () => Promise.resolve('B');
// Please write a function that calls these 2 async functions in parallel and combines the results into a single object.
// asyncA and asyncB are independent, should be called in parallel.
const callAsync = () => {
// your code should be here
// ...
}
callAsync().then(result => console.log(result)); // should print: {a: 'A', b: 'B'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment