function phone(name){
//this.name = "mi";
this.name = name;
this.price = function(){
console.log("2000");
}
}
phone.prototype = {
name:"meizu",
price:function(){
console.log("2500");
}
}
var buy = new phone('mi');
console.log(buy.name);
buy.price();既然先在构造器上查找,那buy.__proto__ == phone.prototype有什么用?
西兰花伟大炮
千秋此意
随时随地看视频慕课网APP
相关分类