Anonymous recursive function

If there is an anonymous function

(function(value){
    // Вызываем сами себя
})();

How can I call myself from it (in order to get recursion)?

Author: stanislav, 2011-01-21

2 answers

(function(value){
    arguments.callee(value);
})();
 4
Author: Eitery, 2011-01-21 14:16:56

I had to deal with the recursion of an anonymous function. I support Dmitry's answer, but I advise you to use:

(callee = function(){ callee(); })();

Since often in a recursive function there are many callbacks in which arguments.callee(value); will call the same callback-and.

 1
Author: Viktor, 2011-01-26 08:30:50