Test failing despite the code is correct

The test “You should use recursion” keep failing, but the code is recursive. Maybe there are a problem with the test.


function sum(arr, n) {
if (n <= 0) return arr[0];

return sum(arr, n - 1) + arr[n];
}

Apparently there is a bug with this challenge in Firefox, although it works in Chrome.

There are some workaround? Or just use Chrome?

The bug has been addressed. It just needs to make it into a production update. You can come back to it later, do it in another browser, or just not worry about it.

1 Like

Nice. Thanks! :slight_smile:

Just FYI. The test was using the /s flag and the support for “dotAll” isn’t great.

Here is the (rather embarrassingly old) Firefox bug Implement RegExp s (dotAll) flag for the implementation.

1 Like

I never used that flags in a regex, but it’s good to know Firefox don’t support it, because it’s my main browser. Sadly the bug has been reported for 2 years and there is no a fix yet.

Yes, it’s a bit odd and there are more of them Sync irregexp with upstream (Note: they are all stage 4 now not stage 3). Looking at the last comment in that bug hopefully, it should happen, well as soon as they figure it out.

1 Like

A fix for this has reached the production platform, please check. Happy contributing.

2 Likes

The test run now perfect. Thanks!! :slight_smile: