I have been using [prototype](http://www.prototypejs.org/ “Prototype JavaScript framework: Easy Ajax and DOM manipulation for dynamic web applications”) 1.6 for a while now and the more I use it the more I like it. I want to point out something that is a great improvement.

Prototype 1.5

[1,2,3].each(function(i) {
. . .
}.bind(blah));

Prototype 1.6

[1,2,3].each(function(i) {
. . .
}, blah);

Ok, that doesn’t look like much, and to some people it probably isn’t, but I like the way it cleans up the code. This is especially true when it comes to chaining enumerables.

In all fairness, I don’t think the [prototype core team](http://www.prototypejs.org/core “Prototype JavaScript framework: The Prototype Core Team”) came up with this idiom. I think this has been in [Mootools](http://mootools.net/ “mootools - home”) for over a year, but hey it is still welcome.

Post Information

Tags:

  • No Tags

We're Reading

Feeds/Syndication

Leave a Reply