Free Code Camp Infinite Loop Protection

WARNING: This is not how the editor works anymore, you don’t get the warning, and if you are triggering the infinite loop protection, you need to refactor your code, //noprotect doesn’t work anymore

The Free Code Camp code runner has a built in Infinite Loop Protect feature, leveraged from JSBin’s Loop Protect. The loop protect injects some code into user created loops to allow a safe exit if more than ~500ms has passed without exiting the loop. Loop protect will catch many, but not all infinite loop issues. If you see this message:

Error: Potential infinite loop at line X

It means you have been protected from an infinite loop.

Note: Loop Protect cannot detect infinite recursion.

Disable Loop Protect

In some cases - a slow computer or a long loop - you may get an incorrect loop protect. In order to disable loop protect, add the following comment over the line the loop protection message lists:


Warning: Disabling loop protect means you may potentially allow your code to go into an infinite loop, causing your browser to be unresponsive.

Recovering Unresponsive Code

If you have erred and incorrectly disabled loop protection and now have an unresponsive solution, you can disable Code Auto-Run.

By default, the Free Code Camp site automatically loads and runs your last recorded solution. If you have accidentally created an infinite loop or other irrecoverable error or simply don’t trust the code, you can disable code auto-run by putting the following in your URL: run=disabled



No-Run URL: