Created
January 11, 2017 05:48
-
-
Save doron2402/9c134bf497213e8e7f60d6bd48ac1c68 to your computer and use it in GitHub Desktop.
Simple callback without nesting (no callback hell yet.)
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
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