Files
30-seconds-of-code/snippets/reverseString.md
Angelos Chalaris 5c2eeb3bcc Updated examples
2017-12-27 16:06:16 +02:00

305 B

reverseString

Reverses a string.

Use split('') and Array.reverse() to reverse the order of the characters in the string. Combine characters to get a string using join('').

const reverseString = str => str.split('').reverse().join('');
reverseString('foobar') // 'raboof'