I want to say first. Very beginner. Be kind. However. I am attempting to reverse a string. Put a string into a function as an argument and reverse its order. For example 'hello' should return 'olleh', etc.
I have complete this by doing:
function revString(stringArg) {
return stringArg.split("").reverse().join(");
}
However. By doing it like this:
function revString (stringArg) {
stringArg.split("");
stringArg.reverse();
stringArg.join("");
return stringArg;
}
The resulting output for the second function is that reverse() is not a function. Can someone tell me what the difference here is?