title: How could I iterate with a for loop to create many objects with Object.create on the fly in javascript?
body: <p>I am trying to create a function that will dynamically create objects on the fly based on the input number arguments, but I'm running into an issue with iterating over the Object.create() part. I don't know where to play my i in the for loop, but ideally I would have all the sportsCar objects stored in the sportArray. That is the target at least.</p>
  
  <pre><code>function car(doors, capacity, storage) {
    this.doors = doors;
    this.capacity = capacity;
    this.storage = storage;
  };
  
  
  var van = Object.create(car);
  van.doors = 4;
  van.storage = "rear storage";
  
  var miniVan = Object.create(van);
  miniVan.capacity = "200 LB";
  
  var cargoVan = Object.create(van);
  cargoVan.capacity = "800 LB";
  
  var truck = Object.create(car);
  truck.doors = 2;
  truck.storage = "bed";
  truck.capacity = "1500 LB";
  
  var familyCar = Object.create(car);
  familyCar.doors = 4;
  familyCar.storage = "large trunk";
  familyCar.capacity = "300 LB";
  
  var sportsCar = Object.create(car);
  sportsCar.doors = 2;
  sportsCar.storage = "small trunk";
  sportsCar.capacity = '100 LB'; 
  
  function tally(n1, n2, n3, n4, n5) {
        var sportArray = [];
        var familyArray = [];
        var truckArray = [];
        var miniArray = [];
        var cargoArray = [];
  
      sportsObjs = for(var i = 0; i &lt; n1; i++){
         Object.create(sportsCar);
      }
  
      sportArray.push(sportsObjs);
  
      for (var i = 0; i &lt; n2; i++){
         Object.create(familyCar);
      }
  
      for(var i = 0; i &lt; n3; i++){
         Object.create(truck)
      }
  
      for(var i = 0; i &lt; n4; i++){
          Object.create(miniVan)
      }
  
      for(var i = 0; i &lt; n5; i++){
          Object.create(cargoVan)
      }
  
      return console.log(sportsArray);
  
  }
  </code></pre>