Javascript Meal Maker

I have checked the walkthrough video and cant find the difference between mine and given code. Error message at the bottom. Please help

const menu = {
  _courses: {
    appetizers: [],
    mains: [],
    desserts: [],
  },
  get appeteizers() {
  },
  get mains(){
  },
  get desserts(){
  },
    set appetizers(appetizerIn){

  },
  set mains(mainsIn){
    
  },
  set desserts (dessertsIn){
    
  },
  get _courses(){
    return{
      appetizers: this.appetizers,
      mains: this.mains,
      desserts: this.desserts,
    }
  },
  addDishToCourse (courseName, dishName, dishPrice){
    const dish = {
      name: dishName,
      price: dishPrice,
    }
      this._courses[courseName].push(dish);
  },
  getRandomDishFromCourse(courseName){
    const dishes = this._courses[courseName];
    const randomIndex = Math.floor(Math.random() * dishes.legnth);
    return dishes[randomIndex]
  },
};
menu.addDishToCourse('appetizers', 'Caesar Salad', 4.25)

when i execute the code I get this

/home/ccuser/workspace/learn-javascript-objects-meal-maker/app.js:34
this._courses[courseName].push(dish);

this._courses[courseName] will trigger the getter, but your getters don’t do/return anything. Which results in undefined.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.