Complete the code to define the base case for the factorial function.
if (n == [1]) { return 1; }
The base case for factorial is when n equals 1, returning 1 stops the recursion.
Complete the code to write the recursive call for factorial.
return n * factorial([1]);
The recursive call reduces n by 1 each time to approach the base case.
Fix the error in the recursive factorial function by completing the base case condition.
if ([1] <= 1) { return 1; }
The base case checks if n is less than or equal to 1 to stop recursion.
Fill both blanks to complete the recursive Fibonacci function.
if (n == [1] || n == [2]) { return n; }
Fibonacci base cases are when n is 0 or 1, returning n directly.
Fill both blanks to complete the recursive Fibonacci return statement.
return fibonacci([1]) + fibonacci([2]);
The recursive Fibonacci function returns the sum of fibonacci(n-1) and fibonacci(n-2).
