Skip to content

Instantly share code, notes, and snippets.

@giuscri
Created May 9, 2014 20:50
Show Gist options
  • Save giuscri/a15a2ab404ba13350c72 to your computer and use it in GitHub Desktop.
Save giuscri/a15a2ab404ba13350c72 to your computer and use it in GitHub Desktop.
function forEach(array, f) {
for (i = 0; i < array.length; ++i) {
f(array[i]);
}
}
function foo() {
ret = 4;
return ret;
}
function map(f, array) {
ret = [];
forEach(array, function(element) {
ret.push(f(element));
});
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment