xsnippet logotype

xsnippet

#363484, Untitled [ Text only ]

by Guest
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);