Answers for "reverse order string js"

58

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
2

reverse string js

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

reverse a string javascript

var s = userInput[0];
var rev = [];
for(let i=0;i<s.length;i++)
{
    rev.push(s[s.length-1-i]);
}
console.log(rev.join(""));
Posted by: Guest on December-20-2020
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 "Javascript"

Browse Popular Code Answers by Language