Reverse a String should work, but

This code works in other editors, but not in FCC.
Why?


  function reverseString(str) {

      let arr = [];
      arr = str.split('');
      arr.reverse();
      str = arr.join();

      return str;
    }

reverseString("hello");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string

Not quiet. Commas are added between letters like this.

'o,l,l,e,h'

Hint: You need pass a parameter inside your join method.

2 Likes

Right! Sorry I missed that. Thanks for the comment.