Having trouble on the meal maker

const menu = {

_course: {

appetizers:[],

mains:[],

desserts:[],

},

get appetizers(){

return this._courses.appetizers;

},

get mains(){

return this._courses.mains;

},

get desserts(){

return this._courses.desserts;

},

set appetizers(appetizers){

this._courses.appetizers = appetizers;

},

set mains(mains){

this._courses.mains = mains;

},

set desserts(desserts){

this._courses.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(dish);

},

getRandomDishFromCourse(courseName){

const dishes = this._cours[courseName];

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

return dishes[randomIndex];

},

generateRandomMeal() {

const appetizers = this.getRandomDishFromCourse(‘appetizers’);

const main = this.getRandomDishFromCourse(‘main’);

const dessert = this.getRandomDishFromCourse(‘dessert’);

const totalPrice = appetizers.price + mains.price + desserts.price;

return Your meal is ${appetizers.name}, ${main.name}, ${dessert.name}, The price is ${totalPrice}.;

},

};

menu.addDishToCourse(‘appetizers’, ‘nuggets’, 5);

menu.addDishToCourse(‘main’, ‘burger’, 10);

menu.addDishToCourse(‘dessert’, ‘ice cream’, 2.50 );

let meal = _course.generateRandomMeal;

console.log(meal);

Keeps giving me an error, not sure what the problem is!

this is in the context of menu, not, _courses so that object needs to included.

appetizers: this._courses.appetizers,

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