내일배움캠프 #mdn
-
내일배움캠프 12일차 TIL. forEach, map, filter, reduce, find + 스스로 질문하기TIL./내일배움캠프 2024. 4. 26. 23:53
배열 빌트인 함수. forEachArray 인스턴스의 forEach() 메서드는 각 배열 요소에 대해 제공된 함수를 한 번씩 실행합니다.> array.forEach((element) => console.log(element));mapmap() 메서드는 배열 내의 모든 요소 각각에 대하여 주어진 함수를 호출한 결과를 모아 새로운 배열을 반환합니다.> const map1 = array1.map((x) => x * 2);filterArray 인스턴스의 filter() 메서드는 주어진 배열의 일부에 대한 얕은 복사본을 생성하고, 주어진 배열에서 제공된 함수에 의해 구현된 테스트를 통과한 요소로만 필터링 합니다.> const result = words.filter((word) => word.length > 6)..