My Code kills the Browser

My Code kills the Browser
0.0 0

#1

I was writing a Code for The Challange “Steamroller”.
Then suddenly it killed the whole Browser.
Now i cant open it to change it.
Any Idea what to do?


#2

You have created infinite recursion.
FCC uses an infinite loop protection, but it can’t catch every case.
The reason that your browser crashes every time you try to load the challenge is because the code in your editor automatically runs. Try disabling auto run.
Another option is to clear the challenge data from your browser cache.


#3

Read the following thread on temporarily disabling the autorun feature on FCC. This will allow you to make the necessary changes to your code to prevent

https://forum.freecodecamp.org/t/disable-code-auto-run-on-free-code-camp/19511

The following test case causes the infinite loop (as suggested by @ArielLeslie).

steamrollArray([1, [], [3, [[4]]]])

The blank array [] gets recognized as an array by your if statement and then unwrapper is called again. Because you declared i globally instead of prefixing it with the keyword var, you end up with an infinite loop. Avoid global variables when possible.