Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created February 17, 2022 21:55
Show Gist options
  • Save gpDA/1682a671560bd78c3d89304f62a910eb to your computer and use it in GitHub Desktop.
Save gpDA/1682a671560bd78c3d89304f62a910eb to your computer and use it in GitHub Desktop.
const factorialNumber = (num) => {
if (num === 1) return 1;
return num * factorialNumber(num - 1);
}
console.log(factorialNumber(5)); // 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment