Skip to content

Instantly share code, notes, and snippets.

@Hacking-NASSA-with-HTML
Last active December 18, 2022 18:31
Show Gist options
  • Save Hacking-NASSA-with-HTML/a68301447fe3e097da1ef2c53627e7b9 to your computer and use it in GitHub Desktop.
Save Hacking-NASSA-with-HTML/a68301447fe3e097da1ef2c53627e7b9 to your computer and use it in GitHub Desktop.
Function to reverse the order of characters in a word:
// function to reverse the order of characters in a word:
function reverse(word) {
let reversedWord = ''
for (let i = word.length - 1; i >= 0; i--) {
reversedWord = reversedWord.concat(word[i])
}
return reversedWord
}
console.log(reverse('word')) // prints drow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment