const testArray = (...arg) => Math.pow(arg.flat().reduce((s, el) => s + el), 2); let sum = testArray([3, 6, 8, 6, 3, 1, 1, 8], [8, 7, 4, 1, 6, 3]); alert(sum); // 4225