javascript - what is wrong with my code? it should output 0-9 but it failed to do so. I think the error is in go() -


can me debug code? can't see errors in it. there no ouput determine error.

 function go() {     var procedures = [];      (var = 0; < 10; i++)      {         procedures[procedures.length] = function ()          {             alert("you " + + " years old");         }          run_procs(procedures);     }      function run_procs(procs)      {         (var = 0; < procs.length; i++)         {             procs[i]();         }     }      go(); } 

you have executed function inside function. put go(); outside.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -