Meal Maker

addDishToCourse(courseName, dishName, dishPrice) {

const dish = {

  name: dishName,

  price: dishPrice,


return this._courses[courseName].push(dish);


Can anyone explain me how this return statement is working?
I am having trouble figuring this out.

Well for example, lets say we have an appetizer “Tomato soup” that costs $5.
We add this using the method by providing the following input arguments.

addDishToCourse('appetizers', "Tomato soup', 5)

What the method will return is the following:

this_courses['appetizers'].push({name: 'Tomato soup', price: 5})

It will look up the list of ‘appetizers’ and then adds the dish.

Hope this helps

Happy coding!

1 Like