Site freezing on While Loops

Tell us what’s happening:

The site keeps freezing when I hit “run the test”. I have to reload the page to be able to click on anything.

I also tried on Safari and got the same result.

Is it my code or is there something wrong with the site?


**Your browser information:**

User Agent is: <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36</code>.

**Link to the challenge:**
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection

Ah, welcome to infinite loops. You never change the value of x that you test, so you force the browser to run out of memory and crash.

1 Like

Your browser is freezing because it’s an infinite loop. The condition tests whether x is greater than zero OR less than or equal to four. 0 is less than or equal to four, and the value of x never changes, so the condition is always true.

2 Likes

you have not incremented the x so that your browser is crashed .

1 Like

Thank you all! I figured it out.