Reputation: 2969
If passing into calculate(z) on object a would the bind be considered proper "best practice" for scoping x ?
var a = {
x: 10,
calculate: function(z){
return this.x + this.y + z;
}
};
a.calculate.bind({x:a.x, y:3})(10); // 23
Upvotes: 0
Views: 100