title: How to push in array and use Id as index of object
body: <p>This is the result I want to achieve</p>
  <pre><code>    11:{amount:736
      wrk_pay_id:11},
  
      10:{amount:714.29
      wrk_pay_id:10},
  
      14:{amount:500
      wrk_pay_id:14},
  
      13:{amount:857.14
      wrk_pay_id:13},
     
      20:{amount:777
      wrk_pay_id:20}
  </code></pre>
  <p>this the result of DeductionArray.. I want to change <code>0,1,2,3,4</code> indexes to <code>11,10,14,13,20</code></p>
  <pre><code> 0:{amount:736
      wrk_pay_id:11},
  
      1:{amount:714.29
      wrk_pay_id:10},
  
      2:{amount:500
      wrk_pay_id:14},
  
      3:{amount:857.14
      wrk_pay_id:13},
     
      4:{amount:777
      wrk_pay_id:20}
  </code></pre>
  <p>This how I push it on my DeductionArray.. <code>this.generated salary</code> Have <code>4 object</code> and the <code>deduction</code> is on nested array so that I use <code>2 foreach</code> to get the value in <code>deduction</code></p>
  <pre class="lang-js prettyprint-override"><code>const arr = Object.entries(this.generated_salary)
  arr.forEach(([key, value]) =&gt; {
    Object.entries(value.deduction).forEach(([acc, item]) =&gt; {
      this.DeductionArray.push({
        amount: item.amount,
        wrk_pay_id: item.wrk_pay_id
      })
  </code></pre>
  <p>This.generated_salay</p>
  <pre><code>[
    {
      &quot;f_name&quot;: &quot;Cy&quot;,
      &quot;deduction&quot;: {
        &quot;11&quot;: {
          &quot;amount&quot;: 736,
          &quot;wrk_pay_id&quot;: 11
        }
      }
    },
    {
      &quot;f_name&quot;: &quot;Hel&quot;,
      &quot;deduction&quot;: {
        &quot;10&quot;: {
          &quot;amount&quot;: 714.29,
          &quot;wrk_pay_id&quot;: 10
        },
        &quot;14&quot;: {
          &quot;amount&quot;: 500,
          &quot;wrk_pay_id&quot;: 14
        }
      }
    },
    {
      &quot;f_name&quot;: &quot;edd&quot;,
      &quot;deduction&quot;: {
        &quot;13&quot;: {
          &quot;amount&quot;: 857.14,
          &quot;wrk_pay_id&quot;: 13
        }
      }
    },
    {
      &quot;f_name&quot;: &quot;JAY&quot;,
      &quot;deduction&quot;: {
        &quot;20&quot;: {
          &quot;amount&quot;: 777,
          &quot;wrk_pay_id&quot;: 20
        }
      }
    }
  ]
  </code></pre>