Learn Introductory JavaScript by Building a Pyramid Generator step 44; console: Uncaught RangeError: Maximum call stack size exceeded

Your code so far

function padRow() {

const call = padRow()

}
padRow();

this code is accepted, but in the console to the right of the screen i see the error message:
Uncaught RangeError: Maximum call stack size exceeded

Tested my code a few times, but i get this error message the whole time.

Cheers,
Eric

Hi!

Maybe it’s because of the missing semicolon at the end of the new variable declaration.

Try completing the variable declaration with the semicolon at the end of the expression.

Hi there @diegog !
Same error, but thanks for your suggestion!

1 Like

You are getting that error message because you have created an infinite loop.

Here is what is going on with your code

function padRow() {

const call = padRow()

}
padRow();

the last line here of padRow() calls the function.
then inside the padRow function you calling itself again.
then it continues to call itself again, and again and again because there is no condition right now to stop it.

the body of the padRow function should be empty for this step
instead, the const call = padRow() line should be outside of the padRow function

3 Likes

Ahh i see, many thanks! It worked now!
But when you make this mistake like i did, it shouldn’t let you pass the step imo.

Yes, I agree.

I am creating an issue now :+1:

3 Likes

Issue was created here to make it clearer where to write the code

1 Like