-
filter 와 map 의 차이Coding Studying/JavaScript Practice 2022. 10. 27. 13:11
map : 기존의 array 에서 특정기준에 맞는 data만 return 한다. 새로운 array로 return 한다.
filter : 특정기준에 맞는 data를 선별해서 새로운 array를 바꿔서 return 한다.
* filter 에서는 callback함수를통해 요소를 시험한다. true를 반환하면 요소를 유지하고, false이면 반환하여 버린다.
- map
arr.map(callback(currentValue[, index[, array]])[, thisArg])
https://inpa.tistory.com/entry/JS-%F0%9F%93%9A-map-%EA%B3%BC-filter-%EC%B0%A8%EC%9D%B4
'Coding Studying > JavaScript Practice' 카테고리의 다른 글
tabs Project (0) 2022.10.30 Javascript - Web Design: Video and slide Button (0) 2022.10.28 JavaScript - Reduce (0) 2022.10.27 tabs (0) 2022.07.05