DEV Community

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

Thanks for the feedback!