1
0
CompleteNodeJS/playground/8-promises.js
2020-02-15 11:59:45 -07:00

13 lines
275 B
JavaScript

const doWorkPromise = new Promise((resolve, reject) => {
setTimeout(() => {
reject('Things went wrong!')
// resolve([7, 4, 1])
}, 2000)
})
doWorkPromise.then((result) => {
console.log('Success!', result)
}).catch((error) => {
console.log('Error!', error)
})