SOURCE

//创建这个类一进它的构造方法
class Food{

  constructor(food) {
    this.food=food;
  }
    get menu(){
    return this.dish;
  }

  set menu(args){
    return this.dish.push(args);
  }

  cook(){
    console.log(this.food);
  }
}

let food = new Food('面包');
food.cook();
food.menu='香蕉';
food.menu='葡萄';
console.log(food.menu);
console 命令行工具 X clear

                    
>
console