title: Use a function to add and one to remove an object from an array
body: <p>I haven't be able to use the push() method to use the new Food constructor to create new items in my pantry array. I need a function to call that will add objects to the array, and I would like for the id value to be calculated based on the current length of the array.</p>
  
  <p>I have tried to create functions like</p>
  
  <pre><code>groceries = function ()
  { 
      pantry.push(new Food)};
  
  
      var pantry = 
      [
      egg = new Food (1, "Egg", ...)
      ...
      ...
      ];
  
  
      function Food (id, name,...)
      {
      this.id = id;
      this.name = name;
      ...
      };
      this.inquiry = function() {
          return '\n' + this.name + 
          '\n' +
      };
  </code></pre>
  
  <p>I can go to the browser and <code>pantry.push(chicken = new Food(... arguments...);</code> but I'm coming up short on knowledge in how to construct a function that would make the process cleaner. I'm not sure if this is just how it is. Maybe I can't do this with a constructor in mind. I'm very new.</p>
  
  <p>I expect there is a way to type in a function that will use my constructor to format new variables and then push them to the end of my pre made variable pantry. I'd like to be able to use this function in the browser.</p>
  
  <p>so far i'm getting errors like function not defined or syntax error.</p>