Meal Maker - cannot read property 'price' of undefined

When I try to run my code on Project Meal Maker. I get an error saying that it can’t read the property ‘price’ within my array. I’ve tested to make sure that my meals are being “pushed” into the array, and they are, with the property name attached, but it won’t read the property name within my generateRandomMeal() function. I also tested to see if I put a solid value to my totalPrice to see if it would run properly, and the same error came up, but this time saying that it can’t read the ‘name’ property in my array. It keeps saying that price and name are undefined, But they are being pushed into the array. Help would be much appreciated.

added a .log() to your getRandomDishFromCourse:

  getRandomDishFromCourse (courseName) {
    const dishes = this._courses[courseName];
    const randomIndex = Math.floor(Math.random * dishes.length);
    console.log(dishes, randomIndex);
    return dishes[randomIndex];
  },

and I see that randomIndex is NaN (not a number), which is problematic. Because using NaN to look up a value in an array will result in undefined

something goes wrong here:

const randomIndex = Math.floor(Math.random * dishes.length);