javascript 中call,apply的用法
call跟apply说白来,就是把另外一个对象的this,传给当前对象的this ,但是apply跟call的区别是在传入参数的区别,他们两第一参数都是另外一个对象,第二个参数就不同来,
var walk = new function(){this.road = "yuhua road"};
var newwalkman = function (roadname){
var road = "xinhua road";
alert(this.road);
alert(roadname);
}
newwalkman.call(walk,"jianhua road");
可以参考 http://www.cnblogs.com/treasurelife/archive/2008/03/05/1092251.html