title: How to include a JavaScript object in a separate file
body: <p>I'm trying to include a separate .js file so I can pull in a class I created but it doesn't work, can someone tell me why?</p>
  
  <p>playercharacter.js</p>
  
  <pre><code>function PlayerCharacter() {
  this.x = 0; 
  this.y = 0;
  
  this.dx = 5;
  this.dy = 5;
  }
  
  
  PlayerCharacter.prototype.sayHello = function()
  {
   alert ('hello');
  };
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="js/playercharacter.js" type="text/javascript" &gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;script type="text/javascript" &gt;
  var player = new PlayerCharacter();
  player.sayHello();
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>