<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
function Person(name, age) {
this.name = name
this.age = age
}
Person.prototype.sex = '女'
Person.prototype.say = () => {
console.log('hello');
}
function Student(name, age, school) {
Person.call(this. school)
}
Student.prototype.no = '16' <----这里想定义Student独有的属性
Student.prototype = new Person()
Student.prototype.construcotr = Student
const s = new Student('Lucy', 16, '清华小学')
s.say()
console.log(s.sex);
console.log(s.no); <----这里怎么能使用no这个属性
</script>
</body>
</html>
原型链继承后,Student的原型指向Person,所有属性只能在Person的原型中定义(理解没错吧,有错请指正),
现在有个需求是,Student中有个独有的no(学号)属性,希望只有Student可以使用,Perosn不能使用。应该在哪定义怎么实现。
(不想定义在Student的私有属性中,只想定义在原型中)