Skip to content

Instantly share code, notes, and snippets.

@kuznetsovandrey76
Created May 30, 2020 12:26
Show Gist options
  • Save kuznetsovandrey76/3c40ddd11648ed1a62f088df74e0499d to your computer and use it in GitHub Desktop.
Save kuznetsovandrey76/3c40ddd11648ed1a62f088df74e0499d to your computer and use it in GitHub Desktop.
Рекурсия
const fact = (x) => {
if (x == 1) return 1
else return x * fact(x-1)
}
console.log(fact(5)) // 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment