Skip to content

Instantly share code, notes, and snippets.

@wvxavier

wvxavier/2-callbacks.js Secret

Last active Aug 24, 2020
Embed
What would you like to do?
2-callbacks
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