1
0
CompleteNodeJS/playground/8-promises.js

13 lines
275 B
JavaScript
Raw Normal View History

2020-02-15 18:59:45 +00:00
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)
})