reduce() 메서드는 배열의 각 요소에 대해 주어진 리듀서 (reducer) 함수를 실행하고, 하나의 결과값을 반환한다. const array1 = [1, 2, 3, 4]; // 0 + 1 + 2 + 3 + 4 const initialValue = 0; const sumWithInitial = array1.reduce( (accumulator, currentValue) => accumulator + currentValue, initialValue ); console.log(sumWithInitial); // expected output: 10 initialValue 를 선언하지 않으면 초기값은 0이다. 만약 initialValue 를 10으로 선언했다면 output 은 20이 된다. 10 + 1 + ..