原型链的学习
关于原型链的学习
原型链
function Fddm(person,count){
this.person = person;
this.count = count;
}
Fddm.prototype = {
constructor:Fddm //用=相当于替换原来的prototypetype对象,原对象的constructor便不在了,所以要手动添加
sing:function(){
console.log(‘i like sing’)
}
talking:function(){
console.log(‘i like talking’)
}
}
var wxy = new Fddm(‘王心怡’,2)
console.log(wxy.protoFddm.prototype) //true
console.log(Fddm.prototype.constructorFddm) //true
console.log(Fddm.proto==Object.prototype) //true
console.log(Object.proto==null) //true