<html><head>
<title>無(wú)標(biāo)題文檔</title></head><body></body></html><script>
function People() { this.age = 23;
}
People.prototype = { eat: function () {
alert('123');
}
}; function Student(name, skin) {
People.apply(this, arguments);
} var test = new Student('張三', '黃皮膚'); console.log(test.age);
test.eat();</script>為什么test.eat()方法會(huì)有錯(cuò)誤,但是test.age又能正常輸出。
構(gòu)造函數(shù)繼承的一個(gè)問(wèn)題
ABOUTYOU
2018-09-10 15:34:24