function reverseString(str) { const tmpArr = []; for(let i = str.length - 1; i >= 0; i--) { tmpArr.push(str.charAt(i)); } return tmpArr.join(''); } console.log(reverseString('abcde'));