functional answer:

/** * @param {string} s * @return {string} */ const reverseString = s => s ? s.split('').reduce((acc,curr) => curr+acc) : '';