Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sum of two array in javascript

function sumArray(a, b) {
      var c = [];
      for (var i = 0; i < Math.max(a.length, b.length); i++) {
        c.push((a[i] || 0) + (b[i] || 0));
      }
      return c;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #array #javascript
ADD COMMENT
Topic
Name
6+7 =