[JS] Array.prototype.forEach()

cabbage·2023년 1월 16일

JS

목록 보기
7/43
post-thumbnail

Array.prototype.forEach()

forEach() 메서드는 각각의 배열 요소에 대해 인자로 전달 받은 함수를 실행한다.

const arr = ['a', 'b', 'c'];

arr.forEach(element => console.log(element));
// a
// b
// c

참고

profile
캐비지 개발 블로그입니다. :)

0개의 댓글