<aside> 🍦 자주 사용하는 자바스크립트 배열의 함수형 메소드를 정리합니다. 바로가기는 아래의 목차 클릭!

</aside>

forEach

find

map

sort

filter

reduce

reduceRight

forEach()

const array = [1, 2, 3, 4, 5]

array.forEach(el => console.log(el)) // -> 1, 2, 3, 4, 5

map()

const array = [1, 2, 3, 4, 5]

array.map(el => el * 2) // -> [2, 4, 6, 8, 10]

filter()

const array = [1, 2, 3, 4, 5]

array.filter(el => {if (el % 2 === 1) return el}) // -> [1, 3, 5]

reduce()