This question may seem simple, but despite my efforts to search through Google and other resources, I can't seem to find the answer.
My array of objects looks like this:
const myArr = [
[{
id: 1,
price: 200,
}, {
id: 2,
price: 900,
}, {
id: 3,
price: 100,
}],
[{
id: 5,
price: 100,
}]
];
In simpler terms, I have an array that contains nested arrays, each with objects inside them.
arr [ [ {},{},{} ] , [ {} ] ]
Now, my goal is to determine two things:
- The total count of all products
- The sum of prices for all products
(each object counts as one product)