• Below three code fragments just work fine - on uploading the code - up and including [1v75]. The setTimeout() happens and calls fE(). Not so though in [v1V79]. All three are broken: setTimeout() is not happening, does not throw any error, and fE() is just not invoked.

    Fragment 1:

    var log = function() { console.log(arguments); };
    var f1  = function() { log("f1(): "); f2(); };
    var f2  = function() { log("f2(): "); f3(); };
    var f3  = function() { log("f3(): "); setTimeout(fE,100); };
    var fE  = function() { log("fE(): "); };
    f1();
    

    Fragment 2:

    var log = function() { console.log(arguments); };
    var f1  = function() { log("f1(): "); f2(); };
    var f2  = function() { log("f2(): "); f3(); };
    var f3  = function() { log("f3(): "); setTimeout("fE()",100); };
    var fE  = function() { log("fE(): "); };
    f1();
    

    Fragment 3:

    var log = function() { console.log(arguments); };
    var f1  = function() { log("f1(): "); f2(); };
    var f2  = function() { log("f2(): "); f3(); };
    var f3  = function() { log("f3(): "); setTimeout(function(){ fE(); },100); };
    var fE  = function() { log("fE(): "); };
    f1();
    

    The misterious work around below works:

    var log = function() { console.log(arguments); };
    var f1  = function() { log("f1(): "); f2(); };
    var f2  = function() { log("f2(): "); f3(); };
    var f3  = function() { log("f3(): "); setTimeout(fE,100); };
    var fE  = function() { log("fE(): "); };
    // f1();
    var onInit = function() { f1(); }
    onInit();
    

    But the work around works only if he extra function is THE onInit() function. If onInit() is renamed to, for example, abc(), it is not working...

    ???

About

Avatar for allObjects @allObjects started