Meal Maker-Intro to Javascript

I completed all of my code, my problem is the end result. For some reason, my code is consoling to the log backwards. It reads “Today’s meal is 7 for $Sushi!”, when it should read “Today’s meal is Sushi for $7!”. I even went through the solution video and the result on that is right.

My code is inserted below:
const menu = {
_menu: “”,
_price: 0,

set meal(mealToCheck) {
if (typeof mealToCheck === “string”) {
return (this._meal = mealToCheck);

set price(priceToCheck) {
if (typeof priceToCheck === “number”) {
return (this._price = priceToCheck);
get todaysSpecial() {
if (this._meal && this._price) {
return Today's meal is ${this._meal} for $${this._price}!;
} else {
return Meal or price was not set correctly!

menu._price = “Sushi”;
menu._meal = 7;

Does that look correct?

1 Like

After I watched the Codecademy solution video, it all aligned. So, I thought it did. After your response I looked and couldn’t find what I did wrong.

The code above has price as sushi and meal as 7. Isn’t that the problem you are trying to find?

Oh my gosh :rofl: I feel so stupid. Sometimes the most obvious ones get me. Thank you so much

1 Like

Welcome to the club. Consider this a baptism, of sorts. Happy coding!

P. S. This is something to get used to whenever we get overconfident or whenever complacency creeps in. It is human to fall into both scenarios, and one to set up a mindset to expect and look for. It’s like admitting a mistake before we find it, and not taking it out upon ourselves. Err is part of the process, and always will be.