Stuck on Meal Maker project

I don’t understand why the price setter isn’t reassigning the _price property properly.

const menu = { _meal: '', _price: 0, set meal(mealToCheck) { if(typeof this.meal === 'string') { menu._meal = mealToCheck } }, set price(num) { if(typeof this.price === 'number') { menu._price = num } }, } menu.price = 100 console.log(menu._price)
// You wrote:
if(typeof this.price === 'number') {

// This will work BUT
if(typeof this._price === 'number') {

// BUT you probably mean to check if the user input "num" is a number
if(typeof num === 'number') {

// Same issue in the meal setter
1 Like