Weird error on Reverse a String

I tried a solution to this challenge using recursion:

function reverseString(str) {
    let lastIndex = str.length-1;
    if (lastIndex === 0) return str;
    return str[lastIndex] += reverseString(str.slice(0, lastIndex));
}
 
reverseString("hello");

It works in the developer console in more than one browser I have, but freeCodeCamp just says “1 is read-only”. Is this a bug with freeCodeCamp?

Firefox 61.0.1 on Windows,
Microsoft Edge 42.17134.1.0 on Windows

Link to challenge

If you want to use the spoiler tags correctly, they must go on separate lines by themselves and they must be before and after the 3 backticks used to properly format code. I have moved the tags to the proper location to blur out your code.

1 Like