1
0
CompleteNodeJS/playground/4-callbacks.js

15 lines
267 B
JavaScript
Raw Normal View History

2020-02-15 18:59:45 +00:00
const doWorkCallback = (callback) => {
2019-08-25 20:34:31 +00:00
setTimeout(() => {
2020-02-15 18:59:45 +00:00
//callback('This is my error!', undefined)
callback(undefined, [1, 4, 7])
2019-08-25 20:34:31 +00:00
}, 2000)
}
2020-02-15 18:59:45 +00:00
doWorkCallback((error, result) => {
if (error) {
return console.log(error)
}
console.log(result)
2019-08-25 20:34:31 +00:00
})