<html><head> <title>无标题文档</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()方法会有错误,但是test.age又能正常输出。
相关分类