라벨링하다가 계속 에러가 나서 봤더니 데이터로 라벨을 넘겨주는 것이 아니라 y값을 그냥 라벨로 넘겨주면 되는 일이었다. 무식하게 넘겨줘서 일어난 일... 이걸로 팀원들 고생시켰다...ㅜㅠ
const array1 = [1, 2, 3, 4];
// 0 + 1 + 2 + 3 + 4
const initialValue = 0;
const sumWithInitial = array1.reduce(
(previousValue, currentValue) => previousValue + currentValue,
initialValue
);
console.log(sumWithInitial);
// expected output: 10
사용해본 적 없었는데 오늘 팀원이 사용한 것과 공식 문서을 보고 사용 방법을 알게 되었다.