DEV Community

Discussion on: Reverse a string: awful answers only

Collapse
 
akashkava profile image
Akash Kava

Recursive reverse.

function reverse(s) {
if(!s) return “”;
return reverse(s.substring(1)) + s[0];
}