Skip to content

Instantly share code, notes, and snippets.

@DmitryMasley
Last active February 18, 2019 08:24
Show Gist options
  • Save DmitryMasley/ecb17772cf6946d12573506a71437c9a to your computer and use it in GitHub Desktop.
Save DmitryMasley/ecb17772cf6946d12573506a71437c9a to your computer and use it in GitHub Desktop.
const promise1 = new Promise((resolve) => {setTimeout(() => {resolve("success")}, 1000)});
promise1.then((message) => {console.log(`${message} 1`)});
promise1.then(() => {throw "exeption"});
promise1.then((message) => {console.log(`${message} 2`)});
const promise2 = new Promise((resolve) => {setTimeout(() => {resolve("success")}, 2000)});
promise2
.then((message) => {console.log(`${message} 3`)})
.then(() => {throw "exeption"})
.then((message) => {console.log(`${message} 4`)});
console.log("Done");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment