Reverse

Last update in 9/2019

You have string to reverse? Easy, just install yet another package from npm! I'm kidding, there is an easier way with some array magic.

const str = 'Hey, whats up?'

This expression might look a bit confusing but all it does is convert string to array of characters, reverses it and joins back in string.

const reversed = [...str].reverse().join('')

// value: ?pu stahw ,yeH

Enjoy your reversed string!