title: Import functions from another js file. Javascript
body: <p>I have a question about including a file in javascript. 
  I have a very simple example: </p>
  
  <pre><code>--&gt; index.html
  --&gt; models
        --&gt; course.js
        --&gt; student.js
  </code></pre>
  
  <p>course.js:</p>
  
  <pre><code>function Course() {
      this.id = '';
      this.name = '';
  }
  </code></pre>
  
  <p>A student has a course property. like this:</p>
  
  <pre><code>import './course';
  
  function Student() {
      this.firstName = '';
      this.lastName = '';
      this.course = new Course();
  }
  </code></pre>
  
  <p>and the index.html is like: </p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script src="./models/student.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="myDiv"&gt;
          &lt;/div&gt;
          &lt;script&gt;
          window.onload= function() {
              var x = new Student();
              x.course.id = 1;
              document.getElementById('myDiv').innerHTML = x.course.id;
          }
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But I am getting an error on the line "var x = new Student();": </p>
  
  <blockquote>
    <p>Student is not defined</p>
  </blockquote>
  
  <p>When I remove the import from Student, I don't receive the error anymore.
  I have tried to use (require, import, include, create a custom function, export) and none has worked for me.</p>
  
  <p>Anybody knows why? and how to fix that?</p>
  
  <p>P.S. the path is correct, it comes from the autocomplete in VS Code</p>