본문 바로가기
javaScript/JS Tutorial

[javaScript]map()

by mooyou 2022. 12. 10.
728x90
300x250

map()

반복문을 돌면서 배열 안 요소들을 1:1로 매핑 시켜준다 그래서 매핑에서 이름을 따서map

 

 

문법

// Arrow function
map((element) => { /* … */ })
map((element, index) => { /* … */ })
map((element, index, array) => { /* … */ })

// Callback function
map(callbackFn)
map(callbackFn, thisArg)

// Inline callback function
map(function (element) { /* … */ })
map(function (element, index) { /* … */ })
map(function (element, index, array) { /* … */ })
map(function (element, index, array) { /* … */ }, thisArg)

 

 

 

 

참고 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

https://www.w3schools.com/js/js_maps.asp

https://www.zerocho.com/category/JavaScript/post/5acafb05f24445001b8d796d

 

 

728x90
반응형

'javaScript > JS Tutorial' 카테고리의 다른 글

[javaScript] map() set() get()  (0) 2022.12.14
map() 자바스립트  (0) 2022.12.13
[javaScript]set 중복제거  (0) 2022.12.08
[javaScript]레이블(label)  (0) 2022.12.07
자바스크립트 break continue 차이  (0) 2022.12.05

댓글