Tell us what’s happening:
I was struggling with challenge.
I though I made SPLIT -> RESERVE -> JOIN as step.
However, I have a error message “text.split is not a function”. and I have no idea why this is not working…
(1) Is split function not able to read array data?
(2) When I made var text = [str], is ‘hello’ inserted to array[0] ?
Your code so far
//my Answer
function reverseString(str) {
var text = [str];
var splitWords = text.split(’ ');
var reserveWords = splitWords.reverse();
var joinWords = reserveWords.join();
return joinWords;
}
//Hint’s Answer
function reverseString(str) {
return str.split(’’).reverse().join(’’);
}
reverseString(“hello”);```
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
.
Link to the challenge: