title: Can not reach JavaScript object from another JavaScript file
body: <p>I am trying to use <code>Animal</code> object inside the <code>World</code> object but both of them are in different files.</p>
  
  <p><strong>Animal.js :</strong> </p>
  
  <pre><code>function Animal(species, nature) {
  
    // Public Fields
    this.species = species;
    this.nature = nature;
  
    // Private Fields
    var preys = new Array();
  
    // GET Functions
    ..........
    ..........
  
    // SET Functions
    ..........
    ..........  
  }
  </code></pre>
  
  <p><strong>World.js :</strong> </p>
  
  <pre><code>function World() {
  
    var animals = new Array();
  
    var animal = new Animal("Wolf", "Carnivore");    //[1]
  
    animals.push(new Animal("Wolf", "Carnivore"));   //[2]
  }
  </code></pre>
  
  <p>I am calling word class in a basic website which contains nothing but javaScript code which creates a new <code>World</code> instance. Then in the browser, I press F12 and both in step 1 and step 2 I am getting an error.</p>
  
  <p><strong>Error ScreenShot</strong> : [<img src="https://i.stack.imgur.com/rdVoF.png" alt="Error image">]</p>
  
  <p>I think it can not find the animal class. I read a number of articles and also searched on the internet but I could not find(Maybe because of being new in JavaScript).</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>In other words, I am trying to import <code>Animal.js</code> file into the <code>World.js</code> file. Then I will import <code>World.js</code> to <code>Ecosystem.js</code></p>
  
  <p><a href="https://i.stack.imgur.com/vC3gc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vC3gc.png" alt="Folders in my project"></a></p>
  
  <p>And here is the asp.net folder : </p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="scripts/World.js"&gt;&lt;/script&gt;
      &lt;script  type="text/javascript"&gt;
          world = new World();
          world.getOmnivores();
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
          &lt;div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>