function copy(target) {
function fn(){}
fn.prototype = target
return new fn()
}
function inherit(subClass,superClass) {
function fn(){}
fn.prototype = superClass.prototype
let obj = new fn()
obj.constructor = subClass
subClass.prototype = obj
}
function Father(name,age) {
this.name = name
this.age = age
this.backpage = [1,2,3]
this.getName = function(){
console.log(this.name)
}
}
Father.prototype.getAge = function(){
console.log(this.age)
}
function Child(name,age,sex) {
Father.call(this,name,age)
this.sex = sex
}
inherit(Child,Father)
let father = new Father("大明",40,"男")
let obj = new Child("小明",18,"男")
obj.getName()
obj.getAge()
obj.backpage[1] = 4
console.log(obj.backpage)
delete obj.backpage
console.log(obj.backpage)
console.log(father.backpage)
console.log(obj.__proto__)
console.log(father.__proto__.getAge)
console