Reverse a String why?

Reverse a String why?
0
#1

Tell us what’s happening:
i don’t undestand what is the problem, when i test the code on console i received the right answer

function reverseString(str) {
return str.split(’’).reverse();
}

reverseString(“hello”);
(5) [“o”, “l”, “l”, “e”, “h”]

Your code so far

function reverseString(str) {
  return str.split('').reverse();
}

reverseString("hello");

Your browser information:

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

Link to the challenge:
https://www.freecodecamp.org/challenges/reverse-a-string

0 Likes

#2

You are returning an array instead of a string.

0 Likes

#3

the answer expects olleh but you returned (5) [“o”, “l”, “l”, “e”, “h”]

0 Likes

#4

i found my mistake, i should to add .join(), tankhs

0 Likes