Skip to content

Instantly share code, notes, and snippets.

@devCola
Created June 8, 2018 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devCola/3824c726e34b6f1ef2ef19ef5120cb93 to your computer and use it in GitHub Desktop.
Save devCola/3824c726e34b6f1ef2ef19ef5120cb93 to your computer and use it in GitHub Desktop.
PromiseJS when catch() callback returns another promise
new Promise((resolve, reject) => reject(1))
.catch((result) => {
console.log(result);
return new Promise((resolve, reject) => resolve(2))
})
.then((result) => console.log(result))
// result: 1, 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment