标签:blog io ar java on div log cti as
function Class(){
this.name = ‘Class‘;
this.getName = function(){
console.log(this.name);
}
}
function ClassA(){
this.name = ‘ClassA‘;
}
var obj = new Class();
obj.getName.call(ClassA);
/*
调用obj对象的getName方法,以ClassA对象替换当前obj对象,所以class对象中的this指向的ClassA对象.
*/
标签:blog io ar java on div log cti as
原文地址:http://www.cnblogs.com/heqhbk/p/4115150.html