I use the context argument quite a lot in order to be able to recycle those functions as much as possible so `this` is needed in my case plus map and filter do not necessary return a new value based on what's in the function.
"abc".split("").map(function(c){return this(c.charCodeAt(0) - 32)}, String.fromCharCode).join("") // ABC whenever it's a dumb example or not, I don't see that function dangerous, not serializable, or not pure my 2 cents On Wed, Nov 28, 2012 at 5:39 AM, Marius Gundersen <gunder...@gmail.com>wrote: > > > Functions passed to the array methods map, reduce, filter, etc would be > good candidates for pure/side-effect-free functions. These functions > shouldn't alter any state; they should only return a new value based on the > parameter they were sent. >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss