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

14 lines
275 B
JavaScript

const reverseString = function(string) {
let backString = '';
for (i = string.length - 1; i >= 0; i--) {
backString += string[i];
}
console.log(backString);
return backString;
};
reverseString('Howdy');
// Do not edit below this line
module.exports = reverseString;