JS syntax part 2 meal maker

I don’t know where I made a typo. Otherwise, I don’t know where I went wrong. Could anyone lend me an eye, please? Thank you!

const menu = {
_courses: {
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._course[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}, and ${main.name}, and ${dessert.name}, and the total price is ${totalPrice}`;


menu.addDishToCourse(‘appetizers’, ‘salad’, 2.00);
menu.addDishToCourse(‘appetizers’, ‘yogurt’, 2.00);
menu.addDishToCourse(‘appetizers’, ‘nuts’, 2.00);

menu.addDishToCourse(‘mains’, ‘tofu’, 5.00);
menu.addDishToCourse(‘mains’, ‘plant meat’, 5.00);
menu.addDishToCourse(‘mains’, ‘plant seafood’, 5.00);

menu.addDishToCourse(‘desserts’, ‘juice’, 1.00);
menu.addDishToCourse(‘desserts’, ‘coffee’, 1.00);
menu.addDishToCourse(‘desserts’, ‘tea’, 1.00);

const meal = menu.generateRandomMeal();

Is there any error being thrown? If so, could you please post it?

1 Like

Codecademy console window said that appetizer is not identified.

Hi tag,
I think the problem might be your setters, they should be like this:

set appetizers(appetizer) {
this._courses.appetizers = appetizer;
// you're adding a dish (an appetizer) to the course (the appetizers)

But it’s difficult to see because it’s not well formatted, it would help if you edited your original post so that it displays correctly - you can highlight everything and click the </> symbol above the text field.

1 Like