Hacker News new | past | comments | ask | show | jobs | submit login

Also, aside from hoisting, there is a much better solution for named+assigned function declarations, because the reason for naming such a function is to use it recursively. Hence, just use the verb form of the word "recurse" and it immediately self-documents that the function is recursive:

    var fibs = function recurse(n, curr, last) {
        curr = curr || 1;
        last = last || 0;
        return n <= 0 ? last : recurse(n - 1, curr + last, curr);
    };



Good luck with your stack traces.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: