var pet={ word:'...', speak:function(say){ console.log(say+' '+this.word) }}//pet.speak('speak')//speak ...var dog={ word:'wang'}//改变this到dog上pet.speak.call(dog,'speak')//spaeck wang
function pet1(word){ this.word=word; this.speak=function(){ console.log(this.word) }} //类似继承function dog1(word){ pet1.call(this,word); //pet1.apply(this,arguments)}var dog1=new dog1('wang')dog1.speak()//wang