Where is the error coming from?


#1

im at MEAL MAKER PROJECT…, and can not complete it boecause of an error…

https://gist.github.com/87f14462daa8b6055aa27a617cd3e0c5

code:

const menu = {
  
 
  
  
  _courses: {
    appetizers:[],
    mains:[],
    desserts:[],
  },
  
  
  get appetizers(){
      },
  get mains(){
      },
  get desserts (){
      },
  
  
  set appetizers(appetizersIn){
      },
  set mains(mainsIn){
      },
  set desserts(dessertsIn){
      },
  
   get _courses(){
    return {
      appetizers: this._courses.appetizers,
      mains: this._courses.mains,
      desserts: this._courses.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.length);
  },
 
 generateRandomMeal: function () {
   const appetizers = this.getRandomDishFromCourse('appetizers');
   const main = this.getRandomDishFromCourse('main');
   const disserts = this.getRandomDishFromCourse('disserts');
   
    const totalPrice = appetizers.price + main.price + disserts.price;
   
   return `Your meal is ${appetizers.name}, ${main.name}, ${disserts.name} and The price is ${totalPrice}.`;
 },
 
  
 

};

 menu.addDishToCourse('appetizers', 'Caesar Salad', 4.25);
 menu.addDishToCourse('main', 'Caesar Salad', 4.25);
 menu.addDishToCourse('desserts', 'Caesar Salad', 4.25);

let meal = menu.generateRandomMeal();
console.log(meal);

#2

if you define getters and setters:

get appetizers(){
      },
  get mains(){
      },
  get desserts (){
      },
  
  
  set appetizers(appetizersIn){
      },
  set mains(mainsIn){
      },
  set desserts(dessertsIn){
      },

you should implement behavior, because now the methods are used, but they do nothing. Either fix the getters and setters (and put them in the right place), or get rid of them