I am not sure what' wrong with my code, value has been override in the nested for-loop, please help me debug following code. var1 is an array that contains another array called list. Var2 is also an array, and each var2.data is equal to the var1. I tried to setup the list.id = var2.index of each var2.data, but for some reason that all the list.id inside of var2 are equal 2, seems like that value has been override. Please see below:

```
    let var1 = [{
        'name': 'name1',
        'list': [{
            id: 0,
            a: "test1",
            b: 'test2'
          },
          {
            id: 0,
            a: "aac",
            b: 'test2'
          },
          {
            id: 0,
            a: "aad",
            b: 'test2'
          },
        ]
      },
      {
        'name': 'name2',
        'list': [{
            id: 0,
            a: "test1",
            b: 'test2'
          },
          {
            id: 0,
            a: "aac",
            b: 'test2'
          },
          {
            id: 0,
            a: "aad",
            b: 'test2'
          },
        ]
      }
    ];

    let var2 = [{
        claim: 'claim1',
        ifn: '1',
        data: []
      },
      {
        claim: 'claim2',
        ifn: '2',
        data: []
      },
      {
        claim: 'claim3',
        ifn: '3',
        data: []
      },
    ]

    var2.forEach((item, i) => {
      var1.forEach(list => {
        list.list.forEach(val => {
          val.id = i;
        })
        item.data = list;
      })
    })
   console.log(var2)

```

I would like to have that each list.id equal the index of var2, like below, really not sure how to make this code work, please help~

```
var2 = [
{ claim:'claim1',ifn:'1',
  data:
      [{
        'name':'name1',
        'list':[
            {id:0,a:"test1",b:'test2'},
            {id:0,a:"aac",b:'test2'},
            {id:0,a:"aad",b:'test2'},
               ]
        },
        {
         'name':'name2',
         'list':[
                {id:0,a:"test1",b:'test2'},
                {id:0,a:"aac",b:'test2'},
                {id:0,a:"aad",b:'test2'},
               ]
      }]
},
{ claim:'claim2',ifn:'2',
  data:
      [{
        'name':'name1',
        'list':[
            {id:1,a:"test1",b:'test2'},
            {id:1,a:"aac",b:'test2'},
            {id:1,a:"aad",b:'test2'},
         ]
        },
    {
    'name':'name2',
        'list':[
                {id:1,a:"test1",b:'test2'},
                {id:1,a:"aac",b:'test2'},
                {id:1,a:"aad",b:'test2'},
               ]
      }]
},
{ claim:'claim3',ifn:'3',
  data:[{
        'name':'name1',
        'list':[
                {id:2,a:"test1",b:'test2'},
                {id:2,a:"aac",b:'test2'},
                {id:2,a:"aad",b:'test2'},
                ]
        },
        {
        'name':'name2',
        'list':[
            {id:2,a:"test1",b:'test2'},
                {id:2,a:"aac",b:'test2'},
                {id:2,a:"aad",b:'test2'},
               ]
     }]
  }
]

```