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有什么用?
千秋此意
相关分类