Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Created July 30, 2018 23:21
Show Gist options
  • Select an option

  • Save gladchinda/121fcdfa0e9dc15b939d537f27d957dd to your computer and use it in GitHub Desktop.

Select an option

Save gladchinda/121fcdfa0e9dc15b939d537f27d957dd to your computer and use it in GitHub Desktop.
// The traditional function body wrapped in curly braces
// is used here to aid readability.
// Pair of parentheses cannot be omitted
const factorial = (n = 1) => {
return (n <= 1) ? 1 : n * factorial(n - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment