Created
March 14, 2017 15:33
-
-
Save ivandevp/8aeda1d570a7429fa0a239afcbe4f149 to your computer and use it in GitHub Desktop.
Factorial con recursividad en JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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