title: Unable to call function defined in a separate file
body: <p>I have a function <code>login</code> defined in a file <code>index.js</code>:</p>
  
  <pre><code>function login(un, pass){
      ....
  }
  </code></pre>
  
  <p>In my <code>index.html</code>, I have:</p>
  
  <pre><code>&lt;head&gt;
      &lt;title&gt;Title&lt;/title&gt;
      &lt;script src="index.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      ....
      &lt;script&gt;
          ....
          login("user", "pass");
      &lt;/script&gt;
      ....
  &lt;/body&gt;
  </code></pre>
  
  <p>But this gives me the following error in the console:</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: login is not defined</p>
  </blockquote>
  
  <p>Both <code>index.html</code> and <code>index.js</code> are in the same folder. What am I missing here?</p>
  
  <h2>EDIT</h2>
  
  <p>One crucial detail I missed out was that I was hosting this using a Flask server. After some research, I realised that the <code>js</code> file has to be in a folder named <code>static</code>.</p>