
[JS] 배열 데이터 (filter, find, findIndex, indexOf, includes, push, unshift, reverse, slice, splice)
2022. 2. 26. 07:31
개발이야기/JS
배열 데이터의 중요한 메소드만 살펴보려고 했는데..... 중요한게 너무 많다....!! 이번 시간을 마지막으로 진짜 배열데이터 끝짱내자. .filter() filter란 이름그대로 배열 데이터 안에 들어있는 아이템들을 특정한 기준에 의해서 필터링을 하는 것. 그리고 filter된 아이템들을 새로운 배열 데이터로 반환한다. const numbers = [1, 2, 3, 4] const fruits = ['apple', 'banana', 'cherry'] const a = numbers.map(number => { return number number < 3) console.log(a) 위의 코드를..