class Chef{
constructor(food){
this.food = food;
thid.dish = [];
}
//getter
get menu(){
return this.dish
}
//setter
set menu(dish){
this.dish.push(dish)
}
staitc cook(food){
console.log(this.food)
}
}
Chef.cook(‘tomato‘) //tomato
原文:https://www.cnblogs.com/fe-cherrydlh/p/11130207.html