对原型链的考察
function func(name){
this.name= name|| "sapi";
function say() {
console.log("hello" + this.name)
}
}
func.prototype.say = function (prefix) {
console.log(prefix +this.name)
}
new func().say() //undefinedsapi
网友评论