SOURCE

function Animal(name,age){
    this.name = name
    this.age = age
}

Animal.prototype.sayhi = function(){
    console.log(`hello my name is ${this.name},age is ${this.age}`)
}

const sheep = new Animal('sheep')
sheep.sayhi()


function Cat(){
    "use strict"
    Animal.apply(this,arguments)
}

 Cat.prototype = new Animal()

const amy = new Cat('roc',11)
amy.sayhi()
console 命令行工具 X clear

                    
>
console