title: Filling an array with objects in Javascript
body: <p>Currently I have an issue with filling an array which I call <code>input</code> in my code with the object which I call <code>athlete</code> in my code.The object which is called <code>athlete</code> is instantiated using several other arrays. I have attached a jsfiddle link to this post which is basically a simplified version with the same issue. I know the logic might look redundant but that is because it is necessary for this example(the actual logic will work with user input).</p>
  
  <p>My issue is that I am filling an array with <code>new Athlete</code> objects, yet I cannot access a specific property of an object in the array.</p>
  
  <p>I am new to working with objects so I'd appreciate any advice on how to make this work. I have added a last line of code to display my input array.</p>
  
  <pre><code>var input = new Array();
  var girl=[1,1,1,1];
  var boy = [1,1,1,1];
  var balleyscore = [100,400,320,50];
  var boyHeight = [72,68,65,75];
  var girlHeight=[60,57,65,55];
  var boyAge = [19,32,22,25];
  var girlAge = [20,15,32,18];
  //the above are all generate from user inputs
  // they go into the object constructor below
  function athlete(girl, boy,balleyscore, height, age){
  this.girl=girl;
  this.boy=boy;
  this.balleyscore=balleyscore;
  this.height=height;
  this.age = age;
  };
  function insertToObjectArray()
  {  
    var j=0;                
    var i=0;  //insert all our data into one array of the load object
      for(j = 0; j &lt; girl.length;j++)
      {
        input[j]= new athlete(true,false,balleyscore[j],girlHeight[j],girlAge[j]);
      }
      for(j = girl.length; j &lt;=girl.length+boy.length;j++)
      {
        input[j]= new athlete(false,true,0,boyHeight[i],boyAge[i]);
        i++;
      }
  };
  insertToObjectArray();
  
  document.getElementById("demo").innerHTML=input;
  </code></pre>
  
  <p><a href="http://jsfiddle.net/qC5j4/1/" rel="nofollow">http://jsfiddle.net/qC5j4/1/</a></p>