SOURCE

// class Animal{
//     constructor(){
//         this.name='animal';
//     }
//     animalFun(){
//         console.log('animalFun')
//     }
// }
// class Cat extends Animal{
//     constructor(){
//         super();
//         this.catName='cat'
//     }
// }


function Animal() {
    this.name = 'animal';
    this.colors = ['red', 'blue', 'green'];
}
Animal.prototype.animalFun = function () {
    console.log('animalFunc');
}
function Cat() {
    Animal.call(this);
    this.catName = 'cat'
}
Cat.prototype = new Animal();
Cat.prototype.constructor = Cat;
const smallCat = new Cat();
const middleCat = new Cat();


smallCat.colors.push('#000');
console.log(smallCat.colors)
console.log(middleCat.colors)
console 命令行工具 X clear

                    
>
console