Created
July 13, 2021 15:48
-
-
Save spcbfr/8396e67ed037dd68dff14490ae909ad7 to your computer and use it in GitHub Desktop.
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
// this is my solution to the following freeCodeCamp challenge: | |
// freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string | |
let reverseString = (str) => { | |
let reversedArray = []; | |
let finalString = ""; | |
for(let i = 0; i < str.length; i++){ | |
reversedArray.unshift(str[i]); | |
} | |
for(let j = 0; j < reversedArray.length; j++){ | |
finalString += reversedArray[j] | |
} | |
return finalString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment