📄 8-12.txt
字号:
function Person(myName, myAge) {
this.name = myName;
this.age = myAge;
}
Person.prototype.showInfo = function() {
return ("嗨!我的名字是"+this.name+",我现在"+this.age+"岁了。");
};
//=================================================
function Child(myName, myAge) {
this.$super = Person;
this.$super(myName, myAge);
//下面覆盖showInfo方法
this.showInfo = function() {
return ("嗨!我是一个小孩,我的名字是"+this.name+",我现在"+this.age+"岁了。");
};
}
Child.prototype = new Person();
var child_1 = new Child("Jane", 8);
document.write(child_1.showInfo());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -