function Human(name){ this.name = name; this.m = '5'; this.talk = function(){ console.log(this.name + " "); } } function Student(name, age){ this.name = name; this.age = age; } Human.prototype.myBestMethod = function() { console.log(this.m); } var human = new Human(''); Student.prototype = human; human.m = 6; var student = new Student("Vasia"); student.myBestMethod(); console.log(student.name);