DEV Community

Discussion on: Reverse A String - 5 Methods

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

Talk about over complicating things (for JavaScript at least)

function reverseStr(s) {
    return s.split("").reverse().join("");
}
Enter fullscreen mode Exit fullscreen mode

Job done!

Also you could have at least used JavaScript if you were going to use the JavaScript tag, may I suggest you remove the JS tag from the post as beginners may be really confused and even experienced developers would probably have a few head scratches over trying to convert things like Stack<Character> charStack = new Stack<Character>(); to JS (I mean I can't even work out what the equivalent would be as I don't know that utility in Java)!

Collapse
 
amritanshu profile image
Amritanshu Dev Rawat

I am removing that :)