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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -