hard
Find and Fix Bugs
Analyze code to identify errors and propose solutions.
📝 Konten Prompt
Review the following JavaScript function that is supposed to reverse a string but is currently returning undefined. Identify the logical error, explain why it is happening, and provide the corrected code snippet.