advanced
Debugging Helper
Analyze code to find logical errors and suggest fixes.
📝 प्रॉम्ट सामग्री
Analyze the following JavaScript function intended to reverse a string. Identify the logical error in the code, explain why it is incorrect, and provide the corrected version of the function.