class Chef{ constructor(food){ this.food = food; thid.dish = []; } //getter get menu(){ return this.dish } //setter set menu(dish){ this.dish.push(dish) } cook(){ console.log(this.food) } } let zhangsan =new Chef(); console.log(zhangsan.menu = 'tomato' ); //tomato console.log(zhangsan.menu = 'pizza' ); //pizza console.log(zhangsan.menu); //["tomato","pizza"]