I have the code below which I expect to map the result from the nested array and return a single array having both id's but I get 2 arrays instead. Can someone please guide me on what I'm doing wrongly?
arrayVal = [{
    sources: {
      data: [{
        id: 1
      }]
    }
  },
  {
    sources: {
      data: [{
        id: 2
      }]
    }
  }
]
for (let sub of arrayVal) {
  let result = sub.sources.data.map(x => (x.id))
  console.log(result)
} 
     
     
     
     
    