function testObject(){ this.commonFun=function() { console.log(arguments.callee.caller);
}
}
(function () { function test1() { this.test = "test1";
this.testFun = function () {
(new testObject()).commonFun();
}
} var test1 = new test1();
test1.testFun();
}());
(function () { function test2() { this.test = "test2";
this.testFun = function () {
(new testObject()).commonFun();
}
} var test2 = new test2();
test2.testFun();
}());上面的console.log() 打印的调用函数,但我现在想要的是调用对象的信息,如,test1对象调用的返回的是test1的test属性,就是输出 test1,
test2对象调用的返回的是test2的test属性,就是输出 test2
函数commonFun作用是输出调用对象的的某些属性,就像上面的test属性,不能传入参数
繁星淼淼
Qyouu
随时随地看视频慕课网APP
相关分类