title: How to push object to key array javascript?
body: <p>I have an object like this:</p>
  
  <pre><code>var newService = new Service({
       name: service.name,
       description: service.description,
       supplier: service.supplier,
       price: service.price,
       info_requires: []
  });
  </code></pre>
  
  <p>Here is modal <code>Service</code></p>
  
  <pre><code>var serviceSchema = new Schema({
      name: String,
      description: String,
      supplier: String,
      price: Number,
      info_requires: [{
          name: String,
          type: Number, // 1-text 2-combobox 3-textarea
          limit: []
      }],
  });
  </code></pre>
  
  <p>Here is my data:</p>
  
  <p><code>var services = [{
              name: "Test",
              description: "Des",
              supplier: "Sup",
              price: 123,
              icon: "icon",
              type: 1,
              open: 1,
              info_requires: [
                  {
                      name: "Age",
                      type: 1,
                      limit: []
                  },
                  {
                      name: "Bla bla",
                      type: 1,
                      limit: []
                  }
              ]
          }]</code></p>
  
  <p>I push data to <code>info_requires[]</code> like this:</p>
  
  <pre><code>newService.info_requires.push(service.info_requires[i]) 
  </code></pre>
  
  <p>or </p>
  
  <p><code>newService.info_requires[i].name = (service.info_requires[i].name)</code>
  But it did not work with error: <code>Cannot set property &amp;#39;name&amp;#39; of undefined</code>? Did I do anything wrong?</p>