...
) and Array.prototype.reverse()
to reverse the order of the characters in the string.String.prototype.join('')
.const reverseString = str => [...str].reverse().join('');
reverseString('foobar'); // 'raboof'
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️