I added some tests at the bottom of the function to see what the results would be.
This is the solution it gives
This is the solution I put, but it gives me an error and says “it likely has a syntax error”, however nothing shows up in the console showing that I have an error.
It says this at the top:
720because 6 * 5 * 4 * 3 * 2 * 1 = 720
However, the solution that the practice problem gives makes factorial(6) return 5040. I’m not sure if I misread something or if I’m missing a step. Any assistance is very much appreciated!
Also adding onto this, when I search up in google what the factorial of 1 is it says it’s 1. However, the practice problem seems to be testing the equation to make sure the factorial of 1 is not equal to 1? I don’t really understand why it’s doing that.