Meal Maker - Syntax Error

Hey all! Struggling to get my meal maker project to work. I’m getting a syntax error with my addDishToCourse() method, but I can’t for the life of me find what I’m doing wrong! Would appreciate another set of eyes :slight_smile:

const menu = { _courses: { appetizers: [], mains: [], desserts: [] }, get courses() { return { appetizers: this.appetizers, mains: this.mains, desserts: this.desserts, }; } addDishToCourse (courseName, dishName, dishPrice) { const dish = { name: courseName, price: dishPrice, } return this._courses[courseName].push(dish); } getRandomDishFromCourse(courseName) { const dishes = this._courses[courseName]; const randomIndex = Math.floor(Math.random() * dishes.length); return dishes[randomIndex]; } generateRandomMeal() { const appetizer = this.getRandomDishFromCourse('appetizers'); const main = this.getRandomDishFromCourse('mains'); const dessert = this.getRandomDishFromCourse('desserts'); const totalPrice = appetizer.price + main.price + dessert.price; return `Your meal is ${appetizer.name}, ${main.name}, and ${dessert.name}. The total price is ${totalPrice}.`; } get appetizers() { return this._courses.appetizers; }, set appetizers(appetizerIn) { this._courses.appetizers = appetizerIn; }, get mains() { return this._courses.mains; }, set mains(mainIn) { this._courses.mains = mainIn; }, get desserts() { return this._courses.desserts; }, set desserts(dessertIn) { this._courses.desserts = dessertIn; }, }; menu.addDishToCourse('appetizers', 'salad', '4.00'); menu.addDishToCourse('appetizers', 'wings', '5.00'); menu.addDishToCourse('appetizers', 'fries', '4.50'); 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);

What is addDishToCourse()?

Is it a normal function? Is it a getter? Is it a setter? What are the differences in syntax for function definitions of these? How does one define a regular function if it’s not a getter/setter?

These questions could lead you to an answer. (Remember MDN docs are your friend).

you’re missing commas after the functions,
These are necessary because the functions are the methods of an object.
,

Also, your prices should probably be numbers instead of strings [at the end].

In the function addDishToCourse ,
name: courseName,
should be
name: dishName,