JavaScript์ .reduce()๋ฉ์๋๋ ๋ฐฐ์ด์ ๋ชจ๋ ์์๋ฅผ โโ์ํํ๋ฉฐ ํ๋์ ๊ฐ์น๋ฅผ ์ถ์ฝ(๊ฒฐํฉ)ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.์ฃผ๋ก ๋ฐฐ์ด์ ์์๋ฅผ ํฉ์ฐํ๊ฑฐ๋ ํน์ ํ์์ผ๋ก ๋ณํํ๋ ๋ฐ ํ์ฉ๋ฉ๋๋ค.array.reduce(callback[, initialValue]) const pets = [ { type: "dog", name: "Rex" }, { type: "cat", name: "Fluffy" }, { type: "dog", name: "Spot" },];const groupedPets = pets.reduce((acc, pet) => { (acc[pet.type] = acc[pet.type] || []).push(pet.name); return acc;}, {});console.log(group..