Skip to content

Instantly share code, notes, and snippets.

@robkuz
Created March 5, 2013 10:08
Show Gist options
  • Select an option

  • Save robkuz/5089248 to your computer and use it in GitHub Desktop.

Select an option

Save robkuz/5089248 to your computer and use it in GitHub Desktop.
result = []
for i in [1..3]
result.push -> i * i
for f in result
console.log f()
var result = [];
for (var i = 1; i <= 3; ++i) {
result.push(function() {
return i * i;
});
}
for (var j = 0; j < result.length; j++) {
var f = result[j];
console.log(f());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment