DEV Community

Discussion on: Reverse a String - Four JavaScript Solutions

Collapse
 
quantumsheep profile image
Nathanael Demacon

.split('') can be shortened:

[...string].reverse().join('')
Enter fullscreen mode Exit fullscreen mode
Collapse
 
rhysbrettbowen profile image
Rhys Brett-Bowen

Also good because split will fail badly for some utf8 things like emojis