While loop crashing issues

My lesson on while loop crashes each time i type the code. for that reason am stuck there. please what do i do to fix it?

Hard to say without seeing the code but it’s probably because the condition the while loop is checking is always true. If it’s never false, the code will keep looping forever and cause a crash.


Hi @Godswilly What is your code?

it may be that you have an infinite loop in the editor, to avoid the browser crashing for this infinite loop you need to clear the cache (note this will remove the code in the editor for all the challenges you already completed as that is stored in local storage)

We are currently aware of this issue and are actively working on a solution. Another thing you can attempt to do is click the Reset All Code button fast enough to avoid the browser crashing.

FYI - The fact that you have an infinite loop is not the issue. The issue is that your infinite loop is creating an array that gets larger and larger until you use up all your browser’s allocated memory and then it crashes. You can validate this by placing the following code into the editor for this same challenge. It has an infinite loop but does not consume memory and should not crash the browser.

// Setup
var myArray = [];

// Only change code below this line.
var i = 0;
while(i < 5) {

Thanks a lot. It’s now working.