I moved this question to a new topic, because it had nothing to do with the original topic you posted it under.
Also, I’ve edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (
</>) will also add backticks around text.
Your code above does not work, because even though string.reverse() reverses the string array in-place, string.join(’’) does not join the array in-place. Instead, it returns a string, but since you did not assign the returned value to anything, that returned value is “lost”. If you were to have done either of the following, it would work:
var reversedString = string.join('');