window.color="red";
var o={color:"blue"};
function sayColor(){alert(this.color);}
sayColor();
sayColor.call(this,1,2);
sayColor.call(window,1,2);
sayColor.call(o,1,2);
这样扩充的好处是:对象和方法不需要任何耦合
window.color="red";
var o={color:"blue"};
function sayColor(){alert(this.color);}
sayColor();
sayColor.call(this,1,2);
sayColor.call(window,1,2);
sayColor.call(o,1,2);
这样扩充的好处是:对象和方法不需要任何耦合
转载于:https://www.cnblogs.com/xjt360/p/4058489.html