It looks like you are using a different version of recursion that was taught by freeCodeCamp. The default argument version of recursion works fine, but it doesn’t work the same as recursion based on return values (and it sort of dodges the misunderstandings that people usually have with scope, function calls, and return values).
In this case, the function parameter factorial is storing the ultimate return value rather than building the final result from the base case. There might be an explanation of the original author’s intent from wherever you found this code.