i don’t know why this
TypeError: Cannot read property ‘price’ of undefined at Object.getRandomMeal is still there even though I declared price
get courses() {
return{
appetizers :this.appetizers ,
mains : this.mains ,
desserts : this.desserts
}
},
Check the context. You may need to include the _courses
backing variable in those assignments.
i tried it as you said it’s still does’nt work
For now, remove all the getters and setters except get courses
which is the only one anybody is using, for the most part. The setters and getters can be reinserted when you wish to challenge yourself to get them working.
Temporarily populate the three arrays with some junk data and write some test lines to be sure the getter is working.
console.log(menu.courses.appetizers)
and so on.