title: How to push array to JSON object in angular
body: <p>I have an obj like below</p>
  
  <pre><code>let obj = {staff_changes: []};
  </code></pre>
  
  <p>Here are some test cases: </p>
  
  <ol>
  <li><p>test case -->  success</p>
  
  <pre><code>for (let i = 0; i &lt; 4; i++) {
   obj.staff_changes.push({
    id: 'staff'+i
   });
  }
  </code></pre></li>
  <li><p>test case -->  failed</p>
  
  <pre><code>let obj = {staff_changes: []};
  for (let i = 0; i &lt; 4; i++) {
   obj.staff_changes.push({
    id: i,
    newStaff.push({
     id: 'staff'+i
    });
  
   });
  }
  console.log(obj);
  </code></pre></li>
  </ol>
  
  <p>In test case 2, I'm trying to push an array with name 'newStaff' even it is not present in obj.</p>
  
  <p>In console obj with 4 items is displaying but 'newStaff' is not pushing to obj.</p>