日期:2014-05-16 浏览次数:20417 次
function C1(name){
if(name) this.name = name;
}
function C2(name){
this.name = name;
}
function C3(name){
this.name = "Tom" || "John";
}
C1.prototype.name = "Tom";
C2.prototype.name = "Tom";
C3.prototype.name = "Tom";
alert(C1.name + C2.name + C3.name);
function C1(name){
if(name) this.name = name;
}
function C2(name){
this.name = name;
}
function C3(name){
this.name = "Tom"
------解决方案--------------------
"John";
}
C1.prototype.name = "Tom";
C2.prototype.name = "Tom";
C3.prototype.name = "Tom";
alert(C1.prototype.name + C2.prototype.name + C3.prototype.name);