Answers for "reverse words in a given string"

0

reverse words in a given string

function reverse (word) {
    word = word.split('.').reverse().join('.')
    return word

}
word = 'i.like.this.program.very.much'
word = 'pqr.mno'
console.log(reverse(word))
Posted by: Guest on November-10-2020
0

reverse every word

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 "reverse words in a given string"

Browse Popular Code Answers by Language