You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Return everything section, you put an example of calculating factorial
const fact = n => n === 0
? 1
: n * fact(n - 1)
console.log('Fact of 5: ', fact(5))
With this approach, we will potentially get a stack overflow error , if the number gets large because of recursion and I would love to know what's your thought on this. Other than that, I learned a lot from your repo and thank you for putting these things together.
The text was updated successfully, but these errors were encountered:
In natively functional and some other languages, recursive calls are automatically optimized by the compiler, so we don't need to worry about the stack size. In order to be optimized, your recursion call should follow some rules to match the compiler criteria, like a tail-call, for example.
In the
Return everything
section, you put an example of calculating factorialWith this approach, we will potentially get a stack overflow error , if the number gets large because of recursion and I would love to know what's your thought on this. Other than that, I learned a lot from your repo and thank you for putting these things together.
The text was updated successfully, but these errors were encountered: