title: Why JavaScript function visibility depends on declaration in the same or different script block in HTML
body: <p>If I implement the following JavaScript code block in HTML markup:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          function MyFunc() {
              alert(1);
          }
          var f1 = MyFunc;
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          function MyFunc() {
              alert(2)
          }
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          f1();
      &lt;/script&gt;
  </code></pre>
  
  <p>I get an alert message '1'.
  However, if I use the following code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
              function MyFunc() {
                  alert(1);
              }
              var f1 = MyFunc;
              function MyFunc() {
                  alert(2)
              }
          &lt;/script&gt;
          &lt;script type="text/javascript"&gt;
  
          &lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              f1();
          &lt;/script&gt;
  </code></pre>
  
  <p>I get '2'. Why?
  Tested in IE10, latest FF, Chrome.</p>