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


#1

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

(https://www.codecademy.com/courses/learn-javascript-functions/lessons/functions/exercises/function-declaration?action=lesson_resume&course_redirect=introduction-to-javascript)
<

<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!


#2

@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:


#3

Thanks a lot for your help!


#4

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