I have following code:
$scope.showTotal = function() {
$scope.pT = [];
var iT = 0;
for (var i = 0; i < $scope.od.length; i++) {
console.log($scope.od[i]['bpr']);
iT += $scope.od[i]['bpr'];
// also tried this -> iT = iT + $scope.od[i]['bpr']
}
$scope.pT.push({iTotal: iT});
console.log($scope.popupTotals);
$scope.showPopupNow = true;
}
But I don't know why it's not working.
If the bpr is for example 50 and 43.1034, then it logs the output in console something like this, iTotal:"050.000043.1034"
I am new to JavaScript and I started it directly with AngularJS. So please help me with arithmetic operators in JS. Thank You.