Skip to content

Instantly share code, notes, and snippets.

@bitfishxyz
Created April 29, 2020 04:57
Show Gist options
  • Save bitfishxyz/d1ef36c21606320edbd42f2b9d5db447 to your computer and use it in GitHub Desktop.
Save bitfishxyz/d1ef36c21606320edbd42f2b9d5db447 to your computer and use it in GitHub Desktop.
const promise1 = new Promise((resolve, reject) => {
const timer1 = setTimeout(() => {
resolve('success')
}, 1000)
})
const promise2 = promise1.then(() => {
throw new Error('error!!!')
})
console.log('promise1', promise1)
console.log('promise2', promise2)
const timer2 = setTimeout(() => {
console.log('promise1', promise1);
console.log('promise2', promise2);
}, 2000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment