Advanced
Analyze Code for Bugs
Identify logic errors in a provided code snippet.
📝 提示内容
Analyze the following JavaScript function. Identify why it is returning 'undefined' instead of the expected value. Explain the logic error and provide the corrected code block.