Last active
September 2, 2021 00:31
-
-
Save leodevbro/9daa1314e872a2f3f7c6ebeec5e481c8 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
const makeStringReverse = (inputString) => { | |
const stringLength = inputString.length; | |
const lastIndex = stringLength - 1; // რადგან 0-დან იწყება ინდექსების ათვლა | |
let pasuxi = ""; // ჯერ ცარიელია | |
for (let i = lastIndex; i >= 0; i -= 1) { | |
pasuxi += inputString[i]; | |
} | |
return(pasuxi); | |
}; | |
console.log(makeStringReverse("abcd")); // უნდა დაბეჭდოს dcba |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment