loop for reversing a string javascript code example
Example 1: javascrip reverse text
//more compact way:
"my example text".split("").reverse().join("");
Example 2: reverse a word javascript
function reverseWords(str) {
const allWords = str.split(" ")
return allWords.map(item => item.split("").reverse().join("")).join(" ")
}