Merge pull request #231 from wojtekmaj/change/reverseString-no-spread

reverseString: Replace spread operator with split() for compatibility
This commit is contained in:
Angelos Chalaris
2017-12-19 12:28:13 +02:00
committed by GitHub

View File

@ -2,10 +2,10 @@
Reverses a string.
Use array destructuring and `Array.reverse()` to reverse the order of the characters in the 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].reverse().join('');
const reverseString = str => str.split('').reverse().join('');
// reverseString('foobar') -> 'raboof'
```