Answers for "reverse a word javascript"

11

javascrip reverse text

//more compact way: 
"my example text".split("").reverse().join("");
Posted by: Guest on March-16-2020
1

reverse every word in a string javascript

// hey buddy, here are different implementations, choose your favourite !!

// Examples
// "This is an example!" ==> "sihT si na !elpmaxe"
// "double  spaces"      ==> "elbuod  secaps"

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


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


var reverseWords = s => s.replace(/\S+/g, v => [...v].reverse().join``)
Posted by: Guest on August-17-2020
3

reverse string js

const solution = (str) => str.split("").reverse().join("");
Posted by: Guest on June-19-2020
2

reverse words in a string javascript

function reverseString(str) {
    return str.split("").reverse().join("");
}
reverseString("hello");
Posted by: Guest on May-13-2020
2

reverse string js

str.split('').reduce((reversed, character) =>{
    return character + reversed;
  }, '');
//apple = leppa
Posted by: Guest on July-27-2020
0

reverse a word javascript

function reverseWords(str) {
  const allWords = str.split(" ")
  return allWords.map(item => item.split("").reverse().join("")).join(" ")
}
Posted by: Guest on August-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language