Created
May 31, 2013 19:42
-
-
Save jdaly13/5687482 to your computer and use it in GitHub Desktop.
callback function example vanilla js
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 beverages = ['juice', 'soda', 'beer'] | |
var func = function (thirsty, array, callback) { | |
array.push(thirsty); | |
var first = array[array.length - 1] | |
return callback(first); | |
} | |
func('water', beverages, function (param) { | |
return param | |
}) | |
//will return water |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment