Scusate il titolo un po' ambiguo, ma sta di fatto che ambiguo è di per se il codice in cui mi son imbattuto seguendo il libro Javascript: The Complete Guide (il codice di per sé funziona egregiamente, ma a me serve capire la logica di COME funziona).


Codice PHP:
var whenReady = (function()
                  { 
                     var 
funcs = []; // The functions to run when we get an event
                     
var ready false// Switches to true when the handler is triggered                            
                
                               
[...]
                                                    
                      
// Return the whenReady function
                    
return function whenReady(f
                     {
                        if (
readyf.call(document); // If already ready, just run it
                         
else funcs.push(f); // Otherwise, queue it for later.
                     
}
                              
                  }());




whenReady(function() 
           {
              var 
clock document.getElementById("clock"); // The clock element
              
var icon = new Image(); // An image to drag
              
icon.src "clock-icon.png"// Image URL
             
[....]
          } 
Ora capisco che whenReady assume praticamente il valore di
if (ready) f.call(document);
else funcs.push(f);


ma nel frattempo le variabili ready e funcs, necessarie al funzionamento del codice, dove sono memorizzate?