Created
September 16, 2022 13:30
-
-
Save adeleke5140/f3699511e7f20f0f7eaddd9507f483bf to your computer and use it in GitHub Desktop.
Reverse a string recursively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reverseString(input){ | |
if(input == ""){ | |
return '' | |
} | |
return reverseString(input.substring(1)) + input.charAt(0) | |
} | |
reverseString("Kehinde") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment