Tail call optimization

tail call optimization for writing elegant recursive solutions without the performance tax of ES5

A tail call is a subroutine call performed as the final action of a procedure. That is,

return myFunction()

It is important to understand that ES6 does not introduce new syntax for tail call optimization. It is just a different structure of code to make sure that it is efficient.

Let’s calculate the Fibonacci using recursion:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy