Code won't run but I cannot see error in code


'm having issues with the code tat I have written for Factorial.JS (7/10)


<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
After running this error appears.
Error: "
Did you add an if statement with a condition?

Replace this line with your code. 
function factorial(n) {
  if ((n === 0)) || ((n === 1)) {
    return 1;
  } else {
    return (n * factorial(n - 1));

Can anyone see what I’ve done wrong?

Many thanks!


@nailed1994 at a quick glance it looks to be a syntax mistake there are too many parentheses, it always good to get a second pair of eyes for code review :tada:


Thanks a lot for your help!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.