7. Conclusion: Just Use a Loop
TCO is beautiful and elegant computer science knowledge.
But in practical work, especially web development, "Just use a for loop" is the correct answer.
- Better Readability: Most developers find loops easier to understand than recursion.
- Better Performance: No function call overhead.
- No Compatibility Issues: Runs safely on every browser from IE to Chrome.
"Elegant code isn't code that machines find easy to execute (though TCO is nice), it's code that your colleagues find easy to understand."
TCO teaches us that underneath the syntax sugar, recursion and loops are the same thing (Jumps). Knowing TCO makes you a better engineer, not so you can use it everywhere, but so you understand the cost of your abstractions.