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