Welcome to the coding challenge! Your task is to implement a function that reverses a given string. Consider edge cases such as empty strings or strings with special characters.
function reverseString(str) {
// Your code here
}
// Example usage:
// reverseString("hello") should return "olleh"
Good luck! If you encounter any issues, refer to the documentation or seek hints.
function reverseString(str) {
// Your code here
return str.split('').reverse().join('');
}
Click "Run Code" to see output here.
// Example Test Case:
// Input: "hello"
// Expected Output: "olleh"
// Actual Output: (will appear here)
// Test Case 2:
// Input: ""
// Expected Output: ""
// Actual Output: (will appear here)