본문 바로가기
728x90
300x250

javaScript/JS Tutorial85

[javaScript]자바스크립트 유형 javaScript에는 값을 포함할 수 있는 5가지 데이터 유형이 있다. string number object function 객체에는 6가지 유형이 있다. object Date Array String Number Boolean 값을 포함할 수 없는 2가지 데이터 유형 null undefined 참고 : https://www.w3schools.com/js/js_typeof.asp 2022. 12. 15.
[javaScript] map() set() get() set()메서드를 사용해서 map()에 요소를 추가할 수 있다. // Create a Map const fruits = new Map(); // Set Map Values fruits.set("apples", 500); fruits.set("bananas", 300); fruits.set("oranges", 200); set()메서드는 기존 맵 값을 변경하는 데에도 사용할 수 있다. const fruits = new Map([ ["apples", 500], ["bananas", 300], ["oranges", 200] ]); fruits.set("apples", 200); get()메서드 map에서 키 값을 가져온다. //500 참고 : https://www.w3schools.com/js/js_maps... 2022. 12. 14.
map() 자바스립트 Array.prototype.map() 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) {.. 2022. 12. 13.
[javaScript]map() 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) { /.. 2022. 12. 10.
728x90
반응형