title: Javascript objects in their own class file
body: <p>I am building a site based completely off REST services with a Java backend. I have moderate experience in both Java and PHP, but very little with JavaScript (outside some basic Jquery stuff). My question is do all JavaScript objects have to be defined in a single file, or can they be created in their own class files (like in Java or PHP)? Basically, I want to define a bunch of objects (such as user, product, cart, etc) and then instantiate those objects through REST services on my server, but I am not sure if I have to define all of the objects and the implementation of those objects in one giant file or if I can split them up into several files (like I am used to working with in other OOP languages).</p>
  
  <p>I know you define an object like: </p>
  
  <pre><code>function Car(model, year)
  {
      this.model = model;
      this.year = year;
  }
  </code></pre>