title: execute non-anonymous function on definition
body: <p>I have the following code:</p>
  
  <pre><code>$(document).ready(function() {
  
      var myFunc = function () {
          alert('test');
      };
  
      myfunc();  
  
      jQuery('#type-selector').change(myFunc);
  });
  </code></pre>
  
  <p>The purpose of this code is that I need function "mYfunc" to be executed on both document.ready event and onChange event. This code works perfectly, however I wonder is there a way to avoid the call myFunc(); and execute the function on its definition instead ? In other words I need to keep the reference on function object and execute function "in one line".</p>