Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal runtime error: stack overflow #57

Closed
caracal7 opened this issue Jul 7, 2019 · 4 comments
Closed

fatal runtime error: stack overflow #57

caracal7 opened this issue Jul 7, 2019 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@caracal7
Copy link

caracal7 commented Jul 7, 2019

let num = 45;

function fib(n) {
    if (n <= 1) return 1;
    return fib(n - 1) + fib(n - 2);
}

let res = fib(num);

res;
@jasonwilliams
Copy link
Member

Thanks for raising @caracal7

@caracal7
Copy link
Author

caracal7 commented Jul 7, 2019

You’re welcome 😊

@jasonwilliams jasonwilliams added bug Something isn't working help wanted Extra attention is needed labels Sep 8, 2019
@jasonwilliams
Copy link
Member

Looks like early returns aren't working properly

@jasonwilliams jasonwilliams added this to the v0.4.0 milestone Sep 9, 2019
@jasonwilliams
Copy link
Member

@caracal7 this has now been fixed 😄
It will be a bit slow when putting in a high number, but it won't crash anymore.

We've also added your Fibonacci to our benchmarks to see if we can improve performance over time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants