DEV Community

loading...

Discussion on: How to Reverse a String in JavaScript

Collapse
geocine profile image
Aivan Monceller

We could also use reduce.

function reverse(str){
  return [...str].reduce((rev, char)=> char + rev, ''); 
}
Collapse
anthonyharvey profile image
Anthony Harvey Author

Thanks for the feedback!