阅读背景:

js中7种继承的实现和优缺点

来源:互联网 

原型链继承

function Parent(){
    this.name = 'kevin'
}

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

function Child(){

}
Child.prototype = new Parent()

var child = new Child()
console.log(child.name) //kevin
function Parent(){
    this.name = 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: