본문 바로가기

Algorithms

freeCodeCamp - 2. Reverse a String [Basic Algorithm Scripting]

Reverse a String

 

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string

 

www.freecodecamp.org

 

function reverseString(str) {
  str = str.split('').reverse().join('')
  return str;
}

reverseString("hello");