Created
February 3, 2015 19:15
-
-
Save freeslugs/c9be998f3d171395fb90 to your computer and use it in GitHub Desktop.
little async example
This file contains hidden or 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 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