Skip to content

Instantly share code, notes, and snippets.

@wvxavier
Last active August 24, 2020 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvxavier/cfdceae2f928b1f3d09b9a0d8424e49a to your computer and use it in GitHub Desktop.
Save wvxavier/cfdceae2f928b1f3d09b9a0d8424e49a to your computer and use it in GitHub Desktop.
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