title: Creating a array of objects using a constructor
body: <p>I want to have an People array containing Person objects so that I can access the fields in the object from the array index.</p>
  
  <p>Normally I'd have gone with and object collection or List etc.</p>
  
  <p>Can you help me make this work?...</p>
  
  <pre><code>var people = [];
  
  var person = {
      firstName:"John",
      age:50
    };
  
  
  
  function newPerson(){       
      var p = new person();   //&lt;&lt;&lt; #1. Is this a good approach in JS?
      p.firstName = "Fred";
      p.age = 21;
  
      people.push(p);
  }
  
  
  function totalAge(){
  
      var totalAge =0; 
      for (i = 0; i &lt; people.length; i++){
          totalAge += people[i].age;   //&lt;&lt;&lt;&lt;&lt; #2. This is the kind of access I want.
      }
  }
  </code></pre>