复制代码代码如下所示:
使用调用来实现JS继承
函数A(颜色){
这颜色=颜色;
this.ashowcolor =函数(){
document.writeln(颜色:这);
}
}

函数B(颜色,名称){
a.call(这颜色);

这bname =名称;
this.bshowname =函数(){
document.writeln(bname:+,bname);
}
}

无功obja =新一(红色);
ObjA.AshowColor();
document.writeln();
无功objb =新的B(黑
ObjB.AshowColor();
ObjB.BshowName();
document.writeln();