Skip to content

Instantly share code, notes, and snippets.

@alejandrolechuga
Created March 12, 2013 20:49
Show Gist options
  • Select an option

  • Save alejandrolechuga/5146881 to your computer and use it in GitHub Desktop.

Select an option

Save alejandrolechuga/5146881 to your computer and use it in GitHub Desktop.
function each (object ,fn ) {
var fnLength = fn.length,
key;
console.log(fnLength);
if (fnLength === 1) {
for (key in object) {
fn(object[key]);
}
} else {
for (key in object) {
fn(key, object[key]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment