Files
30-seconds-of-code/snippets/reverseString.md
Angelos Chalaris 97c250bcfb Updated examples
2017-12-27 16:35:25 +02:00

15 lines
305 B
Markdown

### 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('')`.
```js
const reverseString = str => str.split('').reverse().join('');
```
```js
reverseString('foobar') // 'raboof'
```