You might also like

Programming and Your Brain
Performance optimizations and for loops
Functional Programming in JavaScript using LiveScript and


Joe Lippeatt

Unfortunately, the comments have been turned off for this post. Recursion in JS is available; but as the one commenter suggested, has some serious pitfalls. The writer says "Every time your recursive function is called directly a copy of the function’s variables is added to the stack.[sic]" This alone is a justification to avoid extensive recursive stack-plumping code and use for(;;) loops instead. If a stack is so stuffed and execution time so lengthy that the user can't scroll during a sort operation (the justification for using setTimeout()), there may be justification for handling that activity on the server and retrieving the sorted data via http.

over 3 years ago   Like_icon 0 likes  
Abelardo Gonzalez

There are situations where recursion is legitimately necessary. I don't want to dismiss this completely, just because it may seem impractical in normal scenarios. Deadlines and changing requirements can do a lot to create situations you can't predict, where maybe something like this would be very useful: maybe there is no data connection, maybe you are doing some modeling that you are watching as it's done, etc.

over 3 years ago   Like_icon 0 likes  

Talentopoly Newsletter

A once-weekly round-up of the best programming and design posts.

Join 2050+ subscribers

We will never spam or share your email address. Easily unsubscribe