Reverse a String
JAVASCRIPT
Easy
+10 XP
Problem Description
Write a function `reverseString(str)` that returns the string reversed.
Example:
reverseString('hello') → 'olleh'
reverseString('world') → 'dlrow'
reverseString('abcd') → 'dcba'
Example:
reverseString('hello') → 'olleh'
reverseString('world') → 'dlrow'
reverseString('abcd') → 'dcba'
Test Cases
Input: reverseString('hello')
Expected: olleh
Input: reverseString('world')
Expected: dlrow
Input: reverseString('abcd')
Expected: dcba
Input: reverseString('')
Expected:
Your Solution