I recently completed the “No repeats please challenge” with this code:
And it worked just fine. But later, I was trying to demonstrate the code to someone, and everytime I would try to run the tests, I would get this message in the tests log on the side:
Error: SyntaxError: Unsafe or unfinished function declaration
Here is what the JavaScript console in Firefox Nightly showed:
I tried using Chromium instead, but the issue persisted. Here is what was shown in the Chromium JavaScript console:
I tried the code on CodePen, and it worked just fine there. As I looked into the issue some more, I discovered that any function defined like so would cause an issue: const funcName = () => {};
That was weird, because I had done many challenges before, all of which used functions defined like that.
I then tried this simple piece of code:
When I ran the tests, this error appeared in the JavaScript console in Chromium:
Using var
instead of let
made the error not appear in the console. When testing this piece of code in Firefox Nightly, no errors appeared in the JavaScript console, but instead the tests log on the side got stuck showing this message:
// testing challenge…
But this was not happening a couple days ago. let
and const
would both work just fine, as would basically any newer JavaScript feature.
It seems like something has changed in the backend code of freeCodeCamp that has introduced some bugs or something, because now a lot of code that was working (and works just fine on other sites) is no longer passing the tests.
Does anyone have any idea what has gone wrong?