Skip to content

Instantly share code, notes, and snippets.

@ivandevp
Created March 14, 2017 15:33
Show Gist options
  • Select an option

  • Save ivandevp/8aeda1d570a7429fa0a239afcbe4f149 to your computer and use it in GitHub Desktop.

Select an option

Save ivandevp/8aeda1d570a7429fa0a239afcbe4f149 to your computer and use it in GitHub Desktop.
Factorial con recursividad en JS
function factorial(numero) {
if (numero === 1) {
return 1;
}
return numero * factorial(numero - 1);
}
var resultado = factorial(5);
console.log(resultado);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment