i have data from json this data json
var someObject = {
"exam":
[
{
"re": [[{"result": "3"}],[{"result": "1"}],[{"result": "2"}]]
},
{
"re": [[{"result": "4"}],[{"result": "4"}],[{"result": "4"}]]
}
,
{
"re": [[{"result": "2"}],[{"result": "1"}],[{"result": "3"}]]
}
]
};
and the problem is how to sum the result?
and I've tried in code like this
for (var i = 0; i<someObject.exam.length; i++){
for (var y = 0; y < someObject.exam[i].re.length; y++){
$scope.RESS = parseInt(someObject.exam[i].re[y][0].result) +
parseInt(someObject.exam[i].re[y][0].result)
}
}
why the results not same like
3 + 4 + 2; // 9
1 + 4 + 1; // 6
2 + 4 + 3; // 9
this xample from plunk xamplle
I've spent 2 days for something like this, and now I'm tired help me pleasse