What is the fastest factorial function in JavaScript?

You can search for (1…100)! on Wolfram|Alpha to pre-calculate the factorial sequence. The first 100 numbers are: If you still want to calculate the values yourself, you can use memoization: Edit: 21.08.2014 Solution 2 I thought it would be useful to add a working example of lazy iterative factorial function that uses big numbers to get exact result with memoization and cache as comparison I assume you would use some kind … Read more

Recursive print Factorial

return factValue * printFactorial(factValue – factCounter); I assume that you should be using the “next” values instead of these. Edit: Also note that the function takes two parameters and is void. Returning factValue times void doesn’t make sense.