function Parent(){
this.name = "人类"
this.info = {
sex:"男",
age:10
}
this.say = function(){
console.log('hello!')
}
}
Parent.prototype.height = 1.75
Parent.prototype.do = function(){
console.log('do!')
}
function Child(){
Parent.call(this, arguments)
}
function inhreitPrototype(child, parent){
let prototype = Object.create(parent.prototype)
prototype.constructor = child
child.prototype = prototype
}
inhreitPrototype(Child, Parent);
const child = new Child()
console.log(child.name,'child.name')
console.log(child.height)
child.say()
function SuperClass() {
this.colors = ["red", "black"]
this.age = 10
}
function SubClass() {}
SubClass.prototype = new SuperClass()
var o1 = new SubClass()
var o2 = new SubClass()
o1.colors.splice(1, 1, "yellow");
o1.age = 20
console.log(o1.colors)
console.log(o2.colors)
console.log(o1.age)
console.log(o2.age)
console