Named Function Expressions in IE, part 2

Posted by Polshgiant on Stack Overflow See other posts from Stack Overflow or by Polshgiant
Published on 2010-04-21T00:48:55Z Indexed on 2010/04/21 0:53 UTC
Read the original article Hit count: 455

I asked this question a while back and was happy with the accepted answer. I just now realized, however, that the following technique:

var testaroo = 0;
(function executeOnLoad() {
    if (testaroo++ < 5) {
        setTimeout(executeOnLoad, 25);
        return;
    }
    alert(testaroo); // alerts "6"
})();

returns the result I expect. If T.J.Crowder's answer from my first question is correct, then shouldn't this technique not work?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about anonymous-function