JS Built-ins
← Array158 / 226
ArrayArray.prototype.reversebeginner

Array.prototype.reverse() β€” reverse characters of a string

πŸ“– Usage Example
const chars = 'hello'.split('')
chars.reverse().join('')  // β†’ 'olleh'

Split a string into characters, reverse the array, then join to produce a reversed string.

Reversing a string with reverse()

Strings don't have a reverse() method, but you can split into an array of characters, reverse, then join back.

'hello'.split('').reverse().join('') // 'olleh'
πŸ’‘ Hints (2)
  • β€’ Split with `split('')` (empty string delimiter) to get individual characters.
  • β€’ Chain: `.split('').reverse().join('')` in one expression.