What is tail recursion?
Consider a simple function that adds the first N natural numbers. (e.g. sum(5) = 0 + 1 + 2 + 3 + 4 + 5 = 15). Here is a simple JavaScript implementation that uses recursion: function recsum(x) { if (x === 0) { return 0; } else { return x + recsum(x – 1); … Read more