Skip to content

Instantly share code, notes, and snippets.

@stilist
Created June 23, 2010 16:09
Show Gist options
  • Save stilist/450136 to your computer and use it in GitHub Desktop.
Save stilist/450136 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<script>
Array.prototype.each = function (method) {
if (this) {
if (Array === this.constructor) {
for (i = 0; i < this.length; i++) {
method(this[i]);
}
}
}
};
[1, 2].each(function (x) { alert(x); } );
</script>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment