angularjs - How to calculate the sum value of a set of arrays -
good day
i wondering if can assist me in calculating sum value of array of data.
var products = [{'size':'400' },{'size':'500' }] ; angular.foreach(products, function(item){ var total = 0; total += item.size++; return total; });
how use $q.all() statement store information file download section using ignores angular.foreach statment , checks individual items instead.
use reduce instead of angular.foreach
const productsum = products.reduce((sum, product) => sum + parseint (product.size, 10), 0)
$q.all computing multiple promises. think looking in wrong direction.
Comments
Post a Comment