title: In javascript, what is the difference between window.function(){} and var variable = function?
body: <p>I am working on a javascript code where functions are defined in three different ways.</p>
  
  <pre><code>funtion f1(){}
  </code></pre>
  
  <p>and second</p>
  
  <pre><code>var vaiable = f1(){}
  </code></pre>
  
  <p>and third</p>
  
  <pre><code>window.f1 = function(){}
  </code></pre>
  
  <p>I have read about the first two <a href="https://stackoverflow.com/questions/336859/var-functionname-function-vs-function-functionname">here</a> but don't know about the last one.</p>
  
  <p>Will there be a problem if I change the third one to the second one?</p>
  
  <p>What are the pros and cons of third type?</p>
  
  <p>Why it is used particularly?</p>