Sum array with reduce function - Node.js Array

Node.js examples for Array:Array Value

Description

Sum array with reduce function

Demo Code

  
  sum: function sum_of_array(array)
  {/* ww w .j  av  a2s  .c  o  m*/
    return array.reduce(function(a, b) {
      return a + b;
    });
  },

Related Tutorials