Skip to content

Instantly share code, notes, and snippets.

@menicosia
Created December 27, 2015 02:33
Show Gist options
  • Save menicosia/cb4afffaec4b654bb570 to your computer and use it in GitHub Desktop.
Save menicosia/cb4afffaec4b654bb570 to your computer and use it in GitHub Desktop.
var g = { a : 1, b : 2 }
function callBack (key, value) {
console.log("Callback called with key: " + key + "\nAnd value: " + value) ;
}
function doNothing (key, value, cb) {
true ;
console.log(key + ": doing nothing") ;
cb() ;
}
function doLoop () {
for (k in g) {
f = function () {
callBack(k, g[k]) ;
}
doNothing(k, g[k], f) ;
}
}
doLoop() ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment