Function To Reverse A String In JavaScript
23rd December 2022
function reverse(text) {
return text.split('').reverse().join('');
}
console.log(reverse('something')); // gnihtemos
console.log(reverse('abcdefg')); // gfedcba
console.log(reverse('hash bang code')); // edoc gnab hsah
Add new comment