Last active
December 17, 2015 01:39
-
-
Save prabirshrestha/5530404 to your computer and use it in GitHub Desktop.
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
myStuff.forEach(function stuff){ | |
var subStuff = stuff.subStuff; | |
doSomething({ | |
success: (function(subStuff) { // creates a function scope | |
return function(results) { // the actual success callback with subStuff scoped | |
// subStuff and results are now function scoped | |
}; | |
})(subStuff); // immediately invoke the function. | |
}); | |
}); |
Author
prabirshrestha
commented
May 7, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment