Найдите 10 отличий.
const math = {
sum: (arr) => {
return arr.reduce( (res, el) => {
return res += el;
}, 0 );
},
square: (arr) => {
return arr.reduce( (res, el) => {
return res += el * el;
}, 0 );
},
cube: (arr) => {
return arr.reduce( (res, el) => {
return res += el ** 3;
}, 0 );
},
}
alert( math.sum([1,2,3,4,5]) );
alert( math.square([1,2,3,4,5]) );
alert( math.cube([1,2,3,4,5]) );