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

13 lines
224 B
JavaScript
Raw Permalink Normal View History

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