Click in order · JavaScript and TypeScript course · Module 12: Functional Programming

Recursive Factorial Syntax

Arrange the elements of a recursive factorial function:

Items to click

  • return n * factorial(n - 1);
  • if (n <= 1) return 1;
  • }
  • function factorial(n) {

You can check the correct answer by solving this task in the CodeWorlds game.