Hello I have a function where I am summing datas from JSON obj.
$scope.sum = function(username){
//console.log(username);
let model = $scope.data.filter(function(item) {
return item.username == username
});
let tests = {};
model.forEach(function(item) {
if(!tests.hasOwnProperty(item.dept)){
tests[item.dept] = 0;
}
tests[item.dept] += parseFloat(item.task_time) / 60;
});
$scope.data.model = tests;
// console.log(tests);
//console.log($scope.data.model);
}
I am dividing by 60 and it works but result is like 263.08333333333354 I want to have result like 263.08 Is it possible?