3 ms·
This seems a bit worrying to me as a general principle, since Javascript's lack of tail call optimization (TCO) means that you can blow the stack pretty easily
by BalinKing 7y ago
This seems a bit worrying to me as a general principle, since Javascript's lack of tail call optimization (TCO) means that you can blow the stack pretty easily by manually recursing. Just my two cents :-)
- BalinKing 7y ago(Out of curiosity, have you considered starting at raw recursion – like in your example – but then moving on to using utility functions like `map` from e.g. Ramda or lodash?)
- yjhoney 7y agoYes. curriculum starts off with recursion, then moves on to higher order functions and nobody touches recursion again.
- yjhoney 7y agoeventually everyone defaults to using forEach, every, map, reduce, filter, etc. Nobody writes recursion in codebases.