用原型链继承的方式写一个类和子类,继承的关系的理解,原型的理解
function Person(name,age){ this.name=name; this.age=age; } Person.prototype.study=function(){ return "学习" } function Student(class_,name,age){ this.class_=class_; this.name=name; this.age=age; } var p1=new Person() console.log(p1) Student.prototype=new Person(); var s1=new Student("二班","黎明","16"); console.log(s1) console.log(s1.name,s1.age,s1.class_,s1.study());