Kế thừa ngang giữa function (ok)
https://js.edu.vn/7-ke-thua-prototype-ngang-va-doc.html
function Animal(age) {
	this.age = age;
}
Animal.prototype.showAge = function() {
	console.log(this.age);
}
function Cat(color) {
	this.color = color;
}
Cat.prototype = new Animal();
Cat.prototype.showColor = function() {
	console.log(this.color);
}
var kitty = new Cat('Pink');
kitty.age = 5;
kitty.showAge();
kitty.showColor();Previousclass, super, constructor  (ok)NextVí dụ về kế thừa prototype ngang theo function constructor. Liên quan đến hàm call(), sẽ có bài chi
Last updated