Skip to content

Instantly share code, notes, and snippets.

@phiggins42
Created July 12, 2009 02:39
Show Gist options
  • Save phiggins42/145497 to your computer and use it in GitHub Desktop.
Save phiggins42/145497 to your computer and use it in GitHub Desktop.
var foo = [1,2,3];
for(var i = 0; i < foo.length; i++){
(function(el, i){
})(foo[i], i, foo);
}
my.each = function(ar, fn, obj){
for(var i = 0; i < ar.length; i++){
fn.apply(obj || window, ar[i], i, ar);
}
}
my.each(foo, function(el, i){
});
$.each([1,2,3], function(i){
console.log(this == i - 1); // ugh
console.log(i == 0);
console.log(arguments);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment