Created
October 13, 2017 10:50
-
-
Save JacobTheEvans/fca1c138e9468a4032dc4a39b4dcbd20 to your computer and use it in GitHub Desktop.
Callback recipe example
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
var cookChicken = function(cb) { | |
console.log("I am cooking the chicken"); | |
setTimeout(function() { | |
console.log("Chicken is done"); | |
cb(); | |
}, 2000); | |
} | |
var cutVeggies = function() { | |
console.log("I cut the veggies"); | |
} | |
var addChicken = function() { | |
console.log("I added the chicken to the pot"); | |
} | |
var addVeggies = function() { | |
console.log("I added the veggies to the pot"); | |
} | |
console.log("I am cooking now"); | |
cutVeggies(); | |
addVeggies(); | |
cookChicken(addChicken); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment