Im currently doing the “Meal Maker” project in the Javascript course. Link here.
I’m using the code in the post here. What I don’t understand is why after I’m calling my set function that console.log(menu.meal) isnt returning hamburger.
const menu = {
_meal: "hotdog",
_price: 0,
set newMeal(mealToCheck) {
if (typeof mealToCheck === 'string') {
mealToCheck = this._meal;
} else {
console.log("not a string!");
}
},
};
menu.newMeal = "hamburger";
console.log(menu._meal);