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

15 lines
267 B
JavaScript

const doWorkCallback = (callback) => {
setTimeout(() => {
//callback('This is my error!', undefined)
callback(undefined, [1, 4, 7])
}, 2000)
}
doWorkCallback((error, result) => {
if (error) {
return console.log(error)
}
console.log(result)
})