title: var foo = (function(){...})(); ... foo() doesn't work
body: <p>as expected it invokes the function foo the first time, but when i want to use the function another time the following error is thrown:</p>
  
  <pre><code>Uncaught TypeError: Property 'foo' of object [object DOMWindow] is not a function
  </code></pre>
  
  <p>the intention was to define a function (which has to be called immediately, but also later on) - do i have to write the following instead:</p>
  
  <pre><code>function foo() {...}
  foo();
  ... // later on
  foo();
  </code></pre>
  
  <p>or is there a more elegant solution?</p>
  
  <p>EDIT: if you cannot use a variable (even if it's an anonymous function) as a function, what is its advantage anyway?</p>
  
  <p>(why does </p>
  
  <pre><code>var foo = (function(){...})();
  ... // later on
  foo();
  </code></pre>
  
  <p>not work?)</p>