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();既然先在構(gòu)造器上查找,那buy.__proto__ == phone.prototype有什么用?
一個(gè)依舊沒懂的js問題
西蘭花偉大炮
2017-03-19 22:08:05