DEV Community

Discussion on: Reverse a String in JavaScript

Collapse
 
tracygjg profile image
Tracy Gilmore

Lovely article Swarnali. I have another approach for you to consider:
const reverseString = ([...str]) => str.reverse().join('');

console.log(reverseString('abcdefg')); // 'gfedcba' on console.

Collapse
 
swarnaliroy94 profile image
Swarnali Roy

This is another good approach, I didn't know about this one before. Thank you so much!!