Meal maker

I followed the video to help me with Meal Maker and I finished the code, however something is still not right. It says it has something to do with the line,

const dishes = this._course[courseName];

saying that ‘appetizers’ is undefined.

Here is the full code. Any help would be appreciated.

const menu = {

_courses: {

appetizers: [],

mains: [],

desserts: [],

},

get appetizers() {

return this.appetizers;

},

get mains() {

return this.mains;

},

get deasserts() {

return this.desserts;

},

set appetizers(appetizers) {

this._course.appetizers = appetizers;

},

set mains(mains) {

this._course.mains = mains;

},

set desserts(desserts) {

this._course.desserts = desserts;

},

get courses() {

return {

  appetizers: this.appetizers,

  mains: this.mains,

  desserts: this.desserts,

};

},

addDishToCourse(courseName, dishName, dishPrice) {

const dish = {

  name: dishName,

  price: dishPrice,

};

return this._courses[courseName].push(dishName);

},

getRandomDishFromCourse(courseName) {

const dishes = this._course[courseName];

const randomIndex = Math.floor(Math.random() * dishes.length);

return dishes[randomIndex]

},

generateRandomMeal() {

const appetizers = this.getRandomDishFromCourse('appetizers');

const mains = this.getRandomDishFromCourse('mains');

const dessert = this.getRandomDishFromCourse('desserts');

const totalPrice = appetizer.price + main.price + dessert.price;

return `Your meal is ${appetizer.name}, ${main.name}, ${dessert.name}, and the total price is ${totalPrice} `;

},

};

menu.addDishToCourse(‘appetizers’, ‘salad’, 4.00);

menu.addDishToCourse(‘appetizers’, ‘wings’, 4.50);

menu.addDishToCourse(‘appetizers’, ‘fries’, 5.00);

menu.addDishToCourse(‘mains’, ‘steak’, 10.25);

menu.addDishToCourse(‘mains’, ‘salmon’, 7.75);

menu.addDishToCourse(‘mains’, ‘tofu’, 11.20);

menu.addDishToCourse(‘desserts’, ‘ice cream’, 3.00);

menu.addDishToCourse(‘desserts’, ‘coffee’, 3.00);

menu.addDishToCourse(‘desserts’, ‘cake’, 3.25);

const meal = menu.generateRandomMeal();

console.log(meal);

Check your get methods.

get appetizers() {
  return this.appetizers;
}

There is no appetizer property defined on the top menu object level. You want to try to grab the appetizer property from the _courses object.