repl.it
@QuemuelVital/

Reverse String - JS

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function reverseString(str) {
  let arr, t;

  let n = [];

  arr = str.split('');

  t = arr.length -1;

  for(let i = 0; i< arr.length; i++){
    n.push(arr[t]);
    t--;
  }
  
  arr = n.join('')
  return arr;
}

reverseString("I am a dumbass");