Skip to content

Instantly share code, notes, and snippets.

@leodevbro
Last active September 2, 2021 00:31
Show Gist options
  • Save leodevbro/9daa1314e872a2f3f7c6ebeec5e481c8 to your computer and use it in GitHub Desktop.
Save leodevbro/9daa1314e872a2f3f7c6ebeec5e481c8 to your computer and use it in GitHub Desktop.
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