I have an object which is as follows:
const data = [
{name: 'Week 1', owner: 0, others: 4, amt: 4},
{name: 'Week 2', owner: 0, others: 7, amt: 7},
{name: 'Week 3', owner: 0, others: 10, amt: 10},
{name: 'Week 4', owner: 0, others: 12, amt: 12},
{name: 'Week 5', owner: 0, others: 3, amt: 3},
{name: 'Week 6', owner: 0, others: 0, amt: 0},
{name: 'Week 7', owner: 0, others: 9, amt: 9},
];
I have two arrays namely:
var arrayOwner = [0,0,0,0,0,0,0];
var arrayOthers = [2,4,3,6,3,8,9];
The problem is that I have to take the first value of each array (arrayOwner and arrayOthers) and then update the first object inside the data array.
For example, for week 1, 0 from arrayOwner and 2 from arrayOthers would be taken and then updated in the first object of the data array.