Using function.prototype.bind without breaking function.prototype.apply

Jake Verbaten raynos2 at
Wed Sep 7 14:46:44 PDT 2011

var f = function() { return this; }

var g = f.bind(???);

g.apply({ "foo": "bar" }).foo // expect "bar"

Function.prototype.bind set's the thisArg to a certain value. Is there any
way to leave it flexible to be overwritten using `.call` and `.apply` later

Is there any ES:Harmony/strawman proposal for this?

If there is not I propose using `undefined` to tell Function.prototype.bind
to leave thisArg flexible.

The use case would be using .bind to curry parameters without effecting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list