Is it possible to add up all duration
values of an object array without iteration?
const data = [
{
duration: 10
any: 'other fields'
},
{
duration: 20
any: 'other fields'
}
]
Result should be '30'.
let result = 0
data.forEach(d => {
result = result + d.duration
})
console.log(result)