reduce to sum up all values in array of object failed

Viewed 2365

I got [object Object]9778177 as result, I tried to parse the value but doesn't help neither, something is wrong.

let x = [{
  "total_count": 7
}, {
  "total_count": 9
}, {
  "total_count": 778
}, {
  "total_count": 177
}]

let sum = x.reduce((accum, obj) => {
   return accum + obj.total_count
})

console.log(sum)
1 Answers
Related