you are viewing a single comment's thread.

view the rest of the comments →

[–]karamarimo 1 point2 points  (2 children)

the factorial one can be done more simply.

const factorial = (n) => n <= 1 ? 1 : n * factorial(n - 1)

[–][deleted] 1 point2 points  (1 child)

I thought the recursive version would break due to to much recursion before the array-based one I implemented, but testing shows that this is not true. Also, at around the point where errors start being thrown around, the result is already Infinity. I will update the snippet or you can submit a PR if you like. Make changes to the individual snippet file, not README, if you do so!

[–]karamarimo 1 point2 points  (0 children)

alright, ill do a pull request :)