Skip to content

Instantly share code, notes, and snippets.

@shahab570
Last active January 1, 2021 16:17
Show Gist options
  • Save shahab570/a2548cbaf180efb5e7a7b8d19b8e2df9 to your computer and use it in GitHub Desktop.
Save shahab570/a2548cbaf180efb5e7a7b8d19b8e2df9 to your computer and use it in GitHub Desktop.
let take_bath = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("I have finished my bath");
}, 5000);
});
let eat = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("I have finished eating");
}, 3000);
});
Promise.all([take_bath,eat]).then((value) => {
console.log(value); // ["I have finished my bath", "I have finished eating"]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment