> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/advanced/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/advanced/ke-thua-ngang-giua-function-ok.md).

# 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();
```
