The answer is by using arguments.callee.
Let’s see an example. First here’s an example of a recursive function that is not anonymous.
The code shown above returns 5040.
Now if the same were to be written as an anonymous function and called recursively, we will use arguments.callee as shown below:
Output remains the same, i.e. 5040.
Note: arguments.callee cannot be defined in “strict” mode and it can behave slow at times.