const fn = (a, b) => a + b; const a = [1, 2, 3]; const b = [4, 5, 6]; Array.prototype.sum = function (...args) { return this.reduce(...args); }; console.log([a, b].map(v => v.sum(fn)).sum(fn, 100));