Meal Maker


I am working on this Java Script project by the name of Meal Maker and I am having some difficult as I am unable to see my error.

The console keeps showing up as unexpected token.

Could someone please tell me what I am doing wrong.

This is the code that I have written up to now :

const menu = {

_courses: {

appetizers: ,

mains: ,

dessers: ,


get appetizers () {

return this._courses.appetizers;


get mains () {

return this._courses.mains;


get desserts () {

return this._courses.desserts;


set appetizers(appetizers) { = appetizers;


set mains(mains) { = mains;


set desserts(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._courses[courseName];

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

return dishes[randomIndex];


.generateRandomMeal = () => {

const appetizer = .getRandomDishFromCourse(appetizers);

const main = .getRandomDishFromCourse(main);

const dessert = .getRandomDishFromCourse(dessert);

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

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





That is going to be a problem.

I would like to give more context to say that the console is telling that the unexpected token is found on the third parameter (dish Name) of the object addDishToCourse.

I don’t know why that is.

Thank you for finding that typo though :slight_smile:

Hi @css3433303072
The get courses() method has two opening curly brackets but just one closing one.
You forgot the underscore at this._courses on your setters.
And you forgot to wrap your string when returning it in your generateRandomMeal() method.
Also you startet some of your method definitions with a dot. They should start with a lower case letter instead.
You don’t need to return from addDishToCourse() method, because you’re already pushing an object.
And at the end, your function call is misspelled: the ‘t’ is lower case. And the function call needs round brackets with arguments.

Thank you! I will look it back over, taking into account your notes

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