Skip to content

Instantly share code, notes, and snippets.

@doron2402
Created January 11, 2017 05:48
Show Gist options
  • Save doron2402/9c134bf497213e8e7f60d6bd48ac1c68 to your computer and use it in GitHub Desktop.
Save doron2402/9c134bf497213e8e7f60d6bd48ac1c68 to your computer and use it in GitHub Desktop.
Simple callback without nesting (no callback hell yet.)
function passMeCallback(options, callback) {
//do something
const err = null;
const result = options;//some data goes here
return callback(err, result);
}
passMeCallback({ age: 30 }, function(err, result) {
console.log(result); //this will be the options we just passed to the function
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment