Answers for "node js reverse string"

60

javascript reverse a string

function reverseString(s){
    return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Posted by: Guest on August-05-2019
0

reverse order string js

function spinWords(pw){
	let a = pw.split(" ")
    let variavel = ''
    console.log('1º Problema da Vida Real')
    for (var i = 0; i < a.length; i++) {
      if(a[i].length <= 5){
        variavel += a[i].split("").reverse().join().replaceAll("," , "") + " "
      }
      else {
        variavel += a[i] + " "
      }
  }
  return variavel
}

let hey = "hello worlds";
console.log(spinWords(hey)) // olleh worlds
Posted by: Guest on October-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language