Meal Maker '[object Object]' problem

Hello!

I am brand new to coding and have slowly been making my way through the “Full-Stack Development” career path. I have been following along and understanding everything for the most part, but I’m running into an issue with this project.

There are no errors, but when I test my project I get the following instead of what I’m expecting: “Your meal is [object Object], [object Object], and [object Object]. Your total is $x.xx.”

Could anyone please shed some light on what’s going on? Thank you!! :slight_smile:

const menu = { _courses: { appetizers: [], mains: [], desserts: [], }, get appetizers() { return this.appetizers; }, set appetizers(newApp) { this.appetizers = newApp; }, get mains() { return this.mains; }, set mains(newMain) { this.mains = newMain; }, get desserts() { return this.desserts; }, set desserts(newDessert) { this.mains = newDessert; }, get courses() { return { appetizers: this.appetizers, mains: this.mains, desserts: this.desserts, } }, addDishToCourse(courseName, dishName, dishPrice) { const dish = { name: dishName, price: dishPrice, } 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}, ${main}, and ${dessert}. Your total is $${totalPrice}.` }, }; menu.addDishToCourse('appetizers', 'chips', 4.25) menu.addDishToCourse('appetizers', 'fries', 5.27) menu.addDishToCourse('appetizers', 'wings', 6.55) menu.addDishToCourse('mains', 'pizza', 16.25) menu.addDishToCourse('mains', 'burger', 10.00) menu.addDishToCourse('mains', 'steak', 30.00) menu.addDishToCourse('desserts', 'cake', 6.25) menu.addDishToCourse('desserts', 'mousse', 7.25) menu.addDishToCourse('desserts', 'ice cream', 3.25) let meal = menu.generateRandomMeal(); console.log(meal);

Hi,
[object Object] is what you get when you log an object as template literals.
For the variable ‘totalPrice’ you used dot notation to get just the price from the courses: ‘appetizer.price’.
So you obviously already expected ‘appetizer’ to be an object. For the return statement you want to just get the name of the dish as a separate value from the ‘appetizer’ object.