日期:2014-05-16 浏览次数:20433 次
var obj = { arg1: 1, arg2: 2 } function f(a,b){ return this.arg1 + this.arg2 + a + b; } var r = f.call(obj,3,4); // r =10
var obj = { arg1: 1, arg2: 2 } function f(a,b){ return this.arg1 + this.arg2 + a + b; } obj.m = f; var r = obj.m(3,4); delete obj.m;
var obj = { arg1: 1, arg2: 2 } function f(a,b){ return this.arg1 + this.arg2 + a + b; } var r = f.apply(obj,[3,4]); // r =10