title: how to push sub array object into an a array in javascript
body: <p>hi all i am using javascript i am trying to push object values into one array here i attached my code</p>
  <pre><code>var data = [{
              BuildingID: &quot;56&quot;, FloorId: &quot;65&quot;, volume: [{
  
                  one: 12,
                  two: 15,
                  three: 12
              }]
          }]
  
  var MainInfo=[];
              for (i = 0; i &lt; data.length; i++) {
  
                  var obj = {}
                  obj.BuildingID = data[i].BuildingID;
                  obj.FloorId = data[i].FloorId;
                  obj.volume = data[i].volume[0];
                  MainInfo.push(obj);
    
              }
  </code></pre>
  <p>it's working but not fully applicable here i mentioned the excepted output what should i need</p>
  <h1>Current output</h1>
  <p><a href="https://i.stack.imgur.com/uqi6h.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uqi6h.jpg" alt="enter image description here" /></a></p>
  <h1>Expected output</h1>
  <p><a href="https://i.stack.imgur.com/qzPJp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qzPJp.jpg" alt="enter image description here" /></a></p>
  <p>Note:in data volume is dynamic help how to do this</p>