DEV Community

Discussion on: Reverse a String - Four JavaScript Solutions

Collapse
 
quickhand profile image
quickhand

Short, sweet:

[...str].map((_,i,arr) => arr[arr.length-1-i])
Collapse
 
bugmagnet profile image
Bruce Axtens

I'd forgotten about that third parameter into map. Short, sweet, superb!