reverse a word javascript code example

Example 1: javascrip reverse text

//more compact way: 
"my example text".split("").reverse().join("");

Example 2: reverse string js

const solution = (str) => str.split("").reverse().join("");

Example 3: reverse string js

str.split('').reduce((reversed, character) =>{
    return character + reversed;
  }, '');
//apple = leppa

Example 4: reverse a word javascript

function reverseWords(str) {
  const allWords = str.split(" ")
  return allWords.map(item => item.split("").reverse().join("")).join(" ")
}