Last active
December 26, 2017 18:56
-
-
Save AviTapp/00a32ba381031114b08470947846c9e2 to your computer and use it in GitHub Desktop.
Return the factorial of the provided integer.
This file contains 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 factorialize(r) { | |
if (r < 0) return "Your input is garbage!"; | |
if (0 === r) return 1; | |
for (var i = r; i > 1;) r *= --i; | |
return r | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment