Task: Implement Stack-Safe Factorial Function in JavaScript
Task: Implement Stack-Safe Factorial Function in JavaScript: a task in Terminal-Lego-15k (Harbor dataset). ES6 specification includes Tail Call Optimization (TCO), which should allow tail-recursive functions to execute without growing the call stack. However, most JavaScript engines (including V8…
The task
ES6 specification includes Tail Call Optimization (TCO), which should allow tail-recursive functions to execute without growing the call stack. However, most JavaScript engines (including V8 used in Node.js and Chrome) have not implemented TCO, causing stack overflow errors for deeply recursive functions.
Part of PrimeIntellect/Terminal-Lego-15k.