Description: Write a function named reverse that accepts a string and return the reversed string
Note: Don’t use the built-in function reverse()
function reverse(str) {
let result = "";
for (let i = str.length - 1; i >= 0; i--) {
result += str[i];
}
return result;
}
console.log(reverse("abcd")); // dcba
console.log(reverse("12345aa")); // aa54321

![[Day 02] Bandit Problem](https://static.coderbridge.com/img/jinczing/247d23b82e42420aa9310c820b24ba9a.jpg)
![[ 筆記 ]資訊安全 - 雜湊密碼:hash](https://static.coderbridge.com/img/krebikshaw/255d1fad78394e9e9633eed08832c6ff.jpg)