Map() 생성자
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Map()
생성자는 Map
객체를 생성합니다.
구문
매개변수
iterable
Optional-
하나의
Array
혹은 키-값 쌍인 요소를 가진 반복 가능 객체. (예를 들어[[ 1, 'one' ],[ 2, 'two' ]]
과 같이 2개의 요소를 가진 배열). 각각의 키-값 쌍은 새로운Map
에 추가됩니다.
예제
새로운 Map 생성하기
js
const myMap = new Map([
[1, "one"],
[2, "two"],
[3, "three"],
]);
명세서
Specification |
---|
ECMAScript Language Specification # sec-map-constructor |
브라우저 호환성
BCD tables only load in the browser