Here is the link http://jsfiddle.net/92F94/
Here is the code:

function lol(iter, depth){ alert("Из итерации "+iter+", Глубина "+depth) if(depth<5){ for(i=0;i<3;i++){ lol(i,depth+1); } } } lol(0,0); 

I expect that in the first function call, it will be called three times in a cycle, then in each of these exports another three times, and again and again, I’ll have 3 ^ 5 calls. In fact, it turned out that she only works 7 times (I think without the first call). Why is that? Is this what I'm doing wrong, or is it a bug / feature of the language?

  • one
    > Is it something I'm doing wrong, or is it a bug / feature of the language? without looking at the code is ready to put a million dollars, that this is your bug, not a language - DreamChild
  • @DreamChild And look, please? I am completely confused. - sinedsem
  • @DreamChild And, everything, it is not necessary, figured out - sinedsem

1 answer 1

Understood himself.
Comrades, do not repeat my mistakes, do not forget var!

 for(var i=0;i<3;i++){