Advanced
Debug JavaScript Logic
Identify and fix logical errors in code.
📝 プロンプトの内容
Analyze the following JavaScript function designed to calculate the factorial of a number. Identify the logical error that causes it to return 0 for inputs greater than 1, provide the corrected code, and explain why the fix works.