I want to get the sum of my array, I used angular.foreach but when I run the program it keeps displaying "syntax error". What is wrong? The error said is in var sum += value.fare; I think I made the syntax correct so I am wondering why I get syntax errorThanks
My code is:
angular.forEach($scope.ticketList[fare], function(value, key){
var sum += value.fare;
console.log(sum);
//alert(i);
});