-
-
Save wvxavier/cfdceae2f928b1f3d09b9a0d8424e49a to your computer and use it in GitHub Desktop.
2-callbacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const doWorkCallback = callback => { | |
setTimeout(() => { | |
callback("This is an error!", undefined); | |
//callback(undefined, [1,2,3]) | |
}, 2000); | |
}; | |
doWorkCallback((error, result) => { | |
if (error) { | |
return console.log(error); | |
} | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment