SOURCE

// 寄生组合式-es6 class 原理
function Parent(color) {
    this.color = color
}

Parent.prototype.log = function() {
    console.log(this.color)
}

function Son(color) {
    Parent.call(this, color)
}

Son.prototype = Object.create(Parent.prototype)
Son.prototype.constructor = Son

son1 = new Son('red')
son2 = new Son('blue')
son1.log()
son2.log()

function Person() {
    this.type = 'man'
}
Person.prototype.say = function() {
    console.log(this.type)
}

function Lihua() {
    this.age = 18,
    this.like = 'run'
}

Lihua.prototype = new Person()
let lihua = new Lihua()
console.log(lihua)
console.log(lihua.type)
console 命令行工具 X clear

                    
>
console