Meal Maker Project getRandomDishFromCourse ReferenceError

Hey everyone!

So I’m pretty new to coding. I started about less than a month ago, so I hope my question isn’t too noobish for all the pros out there.

I’ve been working on this meal maker project for a bit and came across an error that says my menu.getRandomDishFromCourse() is not defined when I call my menu.generateRandomMeal() method. I’ve gone through and checked spelling and made sure anything referenced within those methods is logging to the console properly.

Here’s the link to the project:
https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-ii/modules/fecp-learn-javascript-syntax-objects/projects/meal-maker

Here’s my code:

menu = {

  courses: {

    appetizers: [],

    mains: [],

    desserts: [],

  },

  addDishToCourse(courseName,dishName,dishPrice) {

    let dish = {

      name: dishName,

      price: dishPrice

    };

    this.courses[courseName].push(dish);

  },

  getRandomDishFromCourse(courseName) {

    let dishes = this.courses[courseName];

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

    return dishes[randomIndex];

  },

  generateRandomMeal() {

    let appetizer = getRandomDishFromCourse("appetizers");

    let main = getRandomDishFromCourse("mains");

    let dessert = getRandomDishFromCourse("desserts");

    let totalCost = appetizer.cost + main.cost + dessert.cost;

    return `Your random three-course meal is: ${appetizer.name} as your appetizer, ${main.name} as your main dish, and ${dessert.name} as your dessert with a total cost of \$${Math.round(totalCost*100)/100}` ;

  }

};

menu.addDishToCourse("appetizers","pizza rolls",3.75);

menu.addDishToCourse("mains","chicken-fried steak",8.95);

menu.addDishToCourse("desserts","chocolate lava cake",5.39);

menu.addDishToCourse("appetizers","pot stickers",2.99);

menu.addDishToCourse("mains","fillet mignon",11.91);

menu.addDishToCourse("desserts","strawberry cheescake",6.25);

console.log(menu.generateRandomMeal());

Just a note: I got rid of the getters and setters that are part of the steps in this project to shorten the code and make it a bit easier to read. I was getting this same error before and after I deleted the getters and setters.

Here’s the error code:

/home/ccuser/workspace/learn-javascript-objects-meal-maker/app.js:21
    let appetizer = getRandomDishFromCourse("appetizers");
                    ^

ReferenceError: getRandomDishFromCourse is not defined
    at Object.generateRandomMeal (/home/ccuser/workspace/learn-javascript-objects-meal-maker/app.js:21:21)
    at Object.<anonymous> (/home/ccuser/workspace/learn-javascript-objects-meal-maker/app.js:35:18)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

I very much appreciate the time you take to help me. Thank you!

You are forgetting to use this. before the name of the functions. Try:

 let appetizer = this.getRandomDishFromCourse("appetizers");

Oh my goodness, you’re right!
I guess for some reason I was thinking in my brain that I didn’t have to reference the object’s methods since it was already in the object. But it definitely does. That fixed my issue. Thank you!