Skip to content

Instantly share code, notes, and snippets.

@jdaly13
Created May 31, 2013 19:42
Show Gist options
  • Save jdaly13/5687482 to your computer and use it in GitHub Desktop.
Save jdaly13/5687482 to your computer and use it in GitHub Desktop.
callback function example vanilla js
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