var arr = [1,2,3,4];  

Method 1:

var total = 0;
$.each(arr,function() {
    total += this;
});

Method 2:

  var sum = eval(arr.join('+'));

Method 3:

  var i = arrMaxInvst.length;
  var sum = 0;
 
  while (--i) 
   sum += arrMaxInvst[i];

Leave a reply