原型链
this与prototype的区别
this是指调用该方法的对象,(我理解有点父节点的意思)
var name='song';
myObj={
name:"xiao",
ziname:{
name:"nan",
fn:function(){
console.log(this)
console.log(this.name)
}
}
};
myObj.ziname.fn();//nan
var fn=myObj.ziname.fn;
fn();//song
其实上面fn()是fn:function(){
console.log(this.name);
}
太难了,啊啊啊啊