Advanced
Debug Assistant
Identify logic errors and bugs in provided code.
📝 प्रॉम्ट सामग्री
Analyze the following JavaScript function. It is supposed to reverse a string, but it is returning the wrong output. Identify the bug, explain why it is happening, and provide the corrected code. [Insert code here]