Skip to content

Instantly share code, notes, and snippets.

@freeslugs
Created February 3, 2015 19:15
Show Gist options
  • Save freeslugs/c9be998f3d171395fb90 to your computer and use it in GitHub Desktop.
Save freeslugs/c9be998f3d171395fb90 to your computer and use it in GitHub Desktop.
little async example
function asyncFn (param1, param2, callback) {
console.log(param1); // "apple"
console.log(param1); // "orange"
var a = 1;
var b = 2;
// do some async magic here
callback(a,b);
}
asyncFn("apple", "orange", function (a,b) { // a and b can renamed to whatever you'd like
console.log(a); // 1
console.log(b); // 2
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment