I have a json in the below format
let newarrayObj = [
{
"cost one": "118",
"cost two": "118",
"cost three": "118"
},
{
"cost one": "118",
"cost two": "118",
"cost three": "118"
},
{
"cost one": "118",
"cost two": "118",
"cost three": "118"
}
]
I need the sum of each object which is 118 + 188 + 118 = 424 and the sum of total which is 424 + 424 + 424 = 1272
approach so far :
Object.entries(newarrayObj).map(([key, value]) => {
Object.values(value).map((j, i) => {
console.log(j);
})
})
how can i get the expected sum values ?