Having a data array like this
"item_tabel": [
{
"method": {
"select_method": 6,
},
"innovation": {
"select_innovation": 2,
},
}
],
How do I calculate the sum?
This is my computed method:
subtotalRow() {
return this.$store.state.item_tabel.map((item,i) => {
return Number(item.method.select_method * item.innovation.select_innovation)
//how to sum (item.method.select_method + item.innovation.select_innovation)
});
},
An example in my table:
No | method | inov | total
1 | 6 | 2 | (6+2 = 8)
2 | 2 | 2 | 4
If using the * operator works and if using + doesn't work.
Thanks!