15 lines
267 B
JavaScript
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)
|
|
})
|