<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
function Person(name, pets) {
this.name = name;
this.pets = pets;
}
Person.prototype.run = function () {
console.log('跑');
};
function Student(num, name, pets) {
Person.call(this, name, pets);
this.num = num;
}
var p = new Person();
Student.prototype = p;
Student.prototype.constructor = Student;
</script>
<script>
var stu = new Student('001', '张三', ['小花']);
var stu2 = new Student('002', '李四', ['小茂']);
console.log(stu);
console.log(stu2);
</script>
</body>
</html>