I want to get sum of the qty values from the data. I tried, but I am only getting the total qty for the first item in the array.
I just want the result 10 from below (4 + 5 + 0 + 1)
let xyz = [{
catid: '1',
catName: 'abc',
product: [{
id: 1,
qty: 4,
},
{
id: 2,
qty: 5,
}
]
},
{
catid: '2',
catName: 'efg',
product: [{
id: 3,
qty: 0,
},
{
id: 4,
qty: 1,
}
]
}
]