reverse letters in word js code example
Example 1: reverse words in a string javascript
function reverseString(str) {
return str.split("").reverse().join("");
}
reverseString("hello");
Example 2: reverse a word javascript
function reverseWords(str) {
const allWords = str.split(" ")
return allWords.map(item => item.split("").reverse().join("")).join(" ")
}