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]