odin-javascript-exercises/03_reverseString/reverseString.js

13 lines
224 B
JavaScript
Raw Permalink Normal View History

2023-06-19 15:33:46 -07:00
const reverseString = function (string) {
let reversed = ''
2021-08-06 23:54:14 -07:00
2023-06-19 15:33:46 -07:00
Array.from(string).reverse().forEach(char => {
reversed += char
})
return reversed
};
// Do not edit below this line
module.exports = reverseString;