jS meal maker project

hi all, i’m having a bit of trouble debugging this. it kicks back a “maximum call stack size exceeded” error on line 26. I understand that indicates argument overload, but i cannot figure out where. the code runs error free until i get to line 63/65* i added in a note to specify the problem and allow you all to go through the same method i have to demonstrate how i ended up at this point. i have looked over each of the hints and the walk through and i still cannot find my fault. if it is a syntax error please specify where and how.
any critical reviews are much appreciated.

const menu = {
mains: ,
desserts: ,
get appetizers(){
return this._courses.appetizers;
get mains(){
return this._courses.mains;
get desserts(){
return this._courses.desserts;
set appetizers(appetizers){
this._courses.appetizers = appetizers;
set mains(mains){
this._courses.mains = mains;
set desserts(desserts){
this._courses.desserts = desserts;
get _courses() {
return {
appetizers: this.appetizers,
mains: this.mains,
desserts: this.desserts,
addDishToCourse(courseName, dishName, dishPrice){
const dish = {
name: dishName,
price: dishPrice,
return this._courses[courseName].push(dish);
getRandomDishFromCourse(courseName) {
const dishes =
const randomIndex =
Math.floor(Math.random() * dishes.length);
return dishes[randomIndex];
const appetizers =
const mains =
const desserts =

const totalPrice = 
  appetizer.price + 
  main.price + 
`Your Meal is ${appetizer.name}, ${main.name}, and ${dessert.name}. Your total is ${totalPrice}.`;


//copy code below this line and then delete. run code. note there are no errors. paste code back in. note error found.

menu.addDishToCourse(‘appetizers’, ‘House Salad’, 4.25);
menu.addDishToCourse(‘appetizers’, ‘Mozzarella Sticks’, 6.75);
menu.addDishToCourse(‘appetizers’, ‘Lettuce Cups’, 10.50);

menu.addDishToCourse(‘mains’, ‘Cheeseburger’, 8.50);
menu.addDishToCourse(‘mains’, ‘Chicken Alfredo’, 10.75);
menu.addDishToCourse(‘mains’, ‘Ribeye’, 14.25);

menu.addDishToCourse(‘desserts’, ‘Cheesecake’, 7.25);
menu.addDishToCourse(‘desserts’, ‘Chocolate Mousse’, 6.75);
menu.addDishToCourse(‘desserts’, ‘Fruit Tart’, 8.00);

const meal = menu.generateRandomMeal();

this function unconditionally calls itself. it never returns. what happens if you run it?

function f() {


could you specify where this issue is in the code provided? im not sure i understand your response.

you need to understand what goes wrong in the code I showed before you can consider your own which is the same situation but with other code around it as well

if you have an error message with a traceback then that is showing the involved locations. if not, then run it in a different interpreter that does show you a traceback.

you can also use printing to find it, since this is an infinite loop, and printing from within a loop would give you a whole lot of repeated output, thus allowing you to find out where it is by whether or not a print is repeated

yes, i understand the function snippet you provided. i may not have been clear. my code runs fine until i call the menu.addDishToCourse(), i fixed all the errors up to that point. im not understanding why when i call that fxn i am given an error at the beginning of the code. if you could specify exactly where you see that i’m calling an empty function, in this code, i am sure that i can trouble shoot it. I was hoping a fresh pair of eyes would see something that i’m not. by providing a simple example and not mirroring it from the code provided, i’m not understanding what youre seeing that i dont. I’m looking for the exact point at which i made the mistake. you dont have to provide the solution, i will do that. i need fresh eyes to verify that there is an issue and where. i can take it from there.

If you look at the error message that my code will trigger, that error message says where the loop is.

So if you look at the error message of your code, you’ll get the same information for your code.

You already have what you’re asking for.

did you delete the bottom half of the code and run it? if so, thank you. i am reviewing my code. if not. thank you. i am reviewing my code.

calling an empty function is not the problem. and no that function is not empty, there’s code in it.

the code I posted is not derived from yours. it is only clarifying what the error message is about. that is the situation that your error message is describing

i understand the error message. i dont know why it doesnt kick back that error through out the code until i get to line 65. thank you, for your responses. i am reviewing my code.

you can create a function that crashes and call it at a later time

If you run my code you get an error message like this:

RangeError: Maximum call stack size exceeded
    at f (a.js:1:11)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)
    at f (a.js:2:3)

which tells you that there is a function call at line 2 which leads to a function call at line 2 which leads to a function call at line 2 … ad infinitum… except that it crashes, at line 1, because there’s no more space for tracking more calls

for your code you’ll have the same thing, possibly involving several locations but still in a loop. you would need to break that cycle.

found it. the underscore on 25 created a monstrous problem.