Answers for "reverse a string with javascript"

60

javascript reverse a string

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

reverse string js

function reverseString(str) {

    var newString = "";

    for (var i = str.length - 1; i >= 0; i--) { 
        newString += str[i]; 

    return newString;
}
 
reverseString('hello');
Posted by: Guest on January-12-2021
0

reverse string javascript

const reverse = (str) => str.split("").reverse().join("");
Posted by: Guest on August-17-2020
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 "reverse a string with javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language