Potential website crash do to infinite loop on Step 64 and 65 of the Pyramid Generator!

I recommend adding a warning to the text, that tells you to remove “i = i + 1” before changing it. As if you were to remove just the “= i” part so you have to type less it would create an infinite loop and nuke the page. (just did 65 same case there if you only delete the “=” sign)

Welcome to forum,

your concerns are noted, but modern multi-core CPUs in combination with the OS can handle the scenario above by allocating other processes to the rest of the system, until the issue is solved.

I see. I apologize for posting something unimportant. I just got exited at the thought of possibly being able to help. Shall I remove this post?

No need to apologize - on a larger scale infinite loops could indeed crash servers, so you have to keep an eye on them.

To give you an example what modern four core 5i CPUs are capable of: I sometimes need to run infinite scripts (add +1 50.000 times, rinse, repeat) to simulate CPU loads. The cores hardly break a sweat even with five of those scripts running at the same time, you really have to crank up the numbers to push them to the limit.

Oh I didn’t knew that. My CPU is quite weak. for me the page froze the moment I left only “i + 1” then I got an “the webpage ran out of memory” error after just a few seconds. Thank you for teaching me something new and the kind answer.

that should not happen, there is an infinite loop protection in place

can you share the code that causes the page to freeze?

Of course. it was like this:

const character = “#”;
const count = 8;
const rows = ;

function padRow(rowNumber, rowCount) {

return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);


for (let i = 0; i < count; i = i + 1) {

/* when I change the line above this comment to: for (let i = 0; i < count; i + 1) and about to type an “=” sign after the “+” the page freezes and I have about one second to delete the “+” or it will cash. I can send a screenshot if needed.*/

rows.push(padRow(i + 1, count));


let result = “”

for (const row of rows) {

result = result + “\n” + row;



It throws the loop protection, but then the page crashes with an out of memory error for me.

I would wait for this to be live Reports of code editor performance degrading over time · Issue #54736 · freeCodeCamp/freeCodeCamp · GitHub , then if it’s not fixed, open an issue

Not sure memoizing that selector will change anything.

I think it is just the loop protection that is too generous and all the console.log is just too much. It happens as well if you set count to something like 5000 (but you don’t get a loop protection warning).

Edit: I should say, it runs just fine in the browser with 5000 iterations. So I don’t mean to say it is just the console logs by themselves. But we are not just using the browser console for the output.

I will, but how do I do that? I only made my account today and only because I wanted to tell about what I found so I don’t know how to open an issue.

You would need a github account to open an issue on github

It seems related to the degrading performance of the editor, and there have been some PRs on trying to fix that, I think I linked the wrong one

The only PR I saw in relation to the now closed issue was memoizing the selector.

But here, there is no submit needed. It just crashes from memory exhaustion after some amount of loops. My initial guess would be the output is somehow related (or the code path for the output, like the transformers) and not just the code.

If I do a performance log with a 2000 long loop, most of the time is spent in Layout and Paint, and some GC.

If I use one of the log method that isn’t “hijacked” to output to the UI, like console.dir, code with more than 8000 loops runs without crashing the browser.

I made an issue to get some visibility.

Oh thank you so much. I didn’t wanted to say it, but I have to idea how do anything on github yet nor I knew when the before mentioned fix was going to be live. It was stressing me out.