sum of two numbers in javascript

Solutions on MaxInterview for sum of two numbers in javascript by the best coders in the world

showing results for - "sum of two numbers in javascript"
Melyne
02 Aug 2020
1function sumArray(a, b) {
2      var c = [];
3      for (var i = 0; i < Math.max(a.length, b.length); i++) {
4        c.push((a[i] || 0) + (b[i] || 0));
5      }
6      return c;
7}
Felipe
14 Mar 2016
1function sumArray(a, b) {
2      var c = [];
3      for (var i = 0; i < Math.max(a.length, b.length); i++) {
4        c.push((a[i] || 0) + (b[i] || 0));
5      }
6      return c;
7}
8