js中用prototype实现继承
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
//prototype 模拟继承
function Person(name,age){
this.name=name;
this.age=age;
}
function Student(){
this.stuId=2222222;
}
Student.prototype=new Person("zhangsan",20);
var stu=new Student();
alert(stu.name);
alert(stu.age);
</script>
</head>
<body>
</body>
</html>