From 52ccdf1f0a1cee3f0659ac78e81c79dae152399b Mon Sep 17 00:00:00 2001 From: MDN Date: Wed, 23 Jun 2021 00:34:06 +0000 Subject: [CRON] sync translated content --- .../global_objects/map/@@tostringtag/index.html | 52 +++++ .../reference/global_objects/map/clear/index.html | 76 +++++++ .../reference/global_objects/map/delete/index.html | 80 +++++++ .../global_objects/map/entries/index.html | 79 +++++++ .../global_objects/map/foreach/index.html | 99 +++++++++ .../reference/global_objects/map/get/index.html | 81 +++++++ .../reference/global_objects/map/has/index.html | 82 +++++++ .../reference/global_objects/map/index.html | 245 +++++++++++++++++++++ .../reference/global_objects/map/map/index.html | 61 +++++ .../reference/global_objects/map/set/index.html | 97 ++++++++ .../reference/global_objects/map/size/index.html | 63 ++++++ 11 files changed, 1015 insertions(+) create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/@@tostringtag/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/clear/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/delete/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/entries/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/foreach/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/get/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/has/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/map/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/set/index.html create mode 100644 files/ko/orphaned/web/javascript/reference/global_objects/map/size/index.html (limited to 'files/ko/orphaned') diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/@@tostringtag/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/@@tostringtag/index.html new file mode 100644 index 0000000000..c3bc792458 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/@@tostringtag/index.html @@ -0,0 +1,52 @@ +--- +title: Map.prototype[@@toStringTag] +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/@@toStringTag +translation_of: Web/JavaScript/Reference/Global_Objects/Map/@@toStringTag +original_slug: Web/JavaScript/Reference/Global_Objects/Map/@@toStringTag +--- +
{{JSRef}}
+ +

Map[@@toStringTag] 프로퍼티의 초기값은 "Map"입니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-@@tostringtag.html")}}
+ + + +
{{js_property_attributes(0,0,1)}}
+ +

문법

+ +
Map[Symbol.toStringTag]
+ +

예제

+ +
Object.prototype.toString.call(new Map()) // "[object Map]"
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype-@@tostringtag', 'Map.prototype[@@toStringTag]')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype-@@tostringtag', 'Map.prototype[@@toStringTag]')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.@@toStringTag")}}

diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/clear/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/clear/index.html new file mode 100644 index 0000000000..292c68789c --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/clear/index.html @@ -0,0 +1,76 @@ +--- +title: Map.prototype.clear() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/clear +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/clear +original_slug: Web/JavaScript/Reference/Global_Objects/Map/clear +--- +
{{JSRef}}
+ +

clear() 메서드는 Map 객체의 모든 요소를 제거합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-clear.html")}}
+ + + +

구문

+ +
myMap.clear();
+
+ +

예제

+ +

clear() 사용하기

+ +
var myMap = new Map();
+myMap.set('bar', 'baz');
+myMap.set(1, 'foo');
+
+myMap.size;       // 2
+myMap.has('bar'); // true
+
+myMap.clear();
+
+myMap.size;       // 0
+myMap.has('bar')  // false
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.clear', 'Map.prototype.clear')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.clear', 'Map.prototype.clear')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.clear")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/delete/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/delete/index.html new file mode 100644 index 0000000000..0db3f71805 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/delete/index.html @@ -0,0 +1,80 @@ +--- +title: Map.prototype.delete() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/delete +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/delete +original_slug: Web/JavaScript/Reference/Global_Objects/Map/delete +--- +
{{JSRef}}
+ +

delete() 메서드는 Map 객체에서 특정 요소를 제거합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-delete.html")}}
+ + + +

구문

+ +
myMap.delete(key);
+ +

매개변수

+ +
+
key
+
Map 객체에서 제거할 요소의 키.
+
+ +

반환 값

+ +

요소가 Map 객체에 존재해서 제거했을 경우 true, 존재하지 않았으면 false.

+ +

예제

+ +

delete() 사용하기

+ +
var myMap = new Map();
+myMap.set('bar', 'foo');
+
+myMap.delete('bar'); // Returns true. Successfully removed.
+myMap.has('bar');    // Returns false. The "bar" element is no longer present.
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.delete', 'Map.prototype.delete')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.delete', 'Map.prototype.delete')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.delete")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/entries/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/entries/index.html new file mode 100644 index 0000000000..202115e2d6 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/entries/index.html @@ -0,0 +1,79 @@ +--- +title: Map.prototype.entries() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/entries +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/entries +original_slug: Web/JavaScript/Reference/Global_Objects/Map/entries +--- +
{{JSRef}}
+ +

entries() 메서드는 Map 객체의 각 요소에 해당하는 [키, 값] 쌍을 Map에 등록한 순서대로 포함한 새로운 Iterator 객체를 반환합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-entries.html")}}
+ + + +

구문

+ +
myMap.entries()
+ +

반환 값

+ +

A new {{jsxref("Map")}} iterator object.

+ +

예제

+ +

entries() 사용하기

+ +
var myMap = new Map();
+myMap.set('0', 'foo');
+myMap.set(1, 'bar');
+myMap.set({}, 'baz');
+
+var mapIter = myMap.entries();
+
+console.log(mapIter.next().value); // ["0", "foo"]
+console.log(mapIter.next().value); // [1, "bar"]
+console.log(mapIter.next().value); // [Object, "baz"]
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.entries', 'Map.prototype.entries')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.entries', 'Map.prototype.entries')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.entries")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/foreach/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/foreach/index.html new file mode 100644 index 0000000000..b26b7c7d37 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/foreach/index.html @@ -0,0 +1,99 @@ +--- +title: Map.prototype.forEach() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/forEach +translation_of: Web/JavaScript/Reference/Global_Objects/Map/forEach +original_slug: Web/JavaScript/Reference/Global_Objects/Map/forEach +--- +
{{JSRef}}
+ +

forEach() 메소드는 Map 오브젝트 내의 key/value 쌍의 개수 만큼 주어진 함수를 순서대로 실행합니다. 

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-foreach.html")}}
+ + + +

문법

+ +
myMap.forEach(callback[, thisArg])
+ +

파라미터

+ +
+
callback
+
각각의 요소를 처리하기 위한 함수.
+
thisArg
+
 callback 을 실행할때 this 로 사용되는 값.
+
+ +

Return value

+ +

{{jsxref("undefined")}}.

+ +

설명

+ +

forEach 메서드는 map의 각각의 키마다 주어진 callback 함수를 실행합니다. 삭제된 키에대해서는 호출되지 않습니다. 그러나, 값이 존재하지만 undefined 인 값에 대해서는 실행됩니다.

+ +

callback 은 3가지 인수로 호출됩니다.

+ + + +

thisArg 파라미터가 forEach 에 제공되면, this 값으로 사용하기 위해 호출될때 callback 으로 넘겨집니다. 그렇지 않으면 undefined 값이 this 값으로 넘겨질 것입니다. 궁극적으로 callback 으로 보여지게 된 this 값은 함수에 의해 보여지는 this 를 결정하기 위한 일반적인 규칙에 따라 결정됩니다.

+ +

각각의 value는 한번씩 사용됩니다. 다만 forEach 가 끝나기 전에 value가 삭제되거나 재추가 된 경우는 예외입니다. callback 은 사용되기 전에 삭제된 value에 의해 호출되지 않습니다. forEach 가 끝나기 전에 새롭게 추가된 value가 사용 됩니다.

+ +

forEach 는 Map 오브젝트 내에 있는 각각의 요소마다 callback 함수를 실행합니다; 깂을 반환하지 않습니다.

+ +

예제

+ +

Map 오브젝트의 내용을 출력

+ +

아래의 코드는 Map 오브젝트 내의 각각 요소들을 행별로 출력합니다:

+ +
function logMapElements(value, key, map) {
+    console.log(`map.get('${key}') = ${value}`);
+}
+new Map([['foo', 3], ['bar', {}], ['baz', undefined]]).forEach(logMapElements);
+// logs:
+// "map.get('foo') = 3"
+// "map.get('bar') = [object Object]"
+// "map.get('baz') = undefined"
+
+ +

Specifications

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.foreach', 'Map.prototype.forEach')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.foreach', 'Map.prototype.forEach')}}{{Spec2('ESDraft')}}
+ +

Browser compatibility

+ + + +

{{Compat("javascript.builtins.Map.forEach")}}

+ +

See also

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/get/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/get/index.html new file mode 100644 index 0000000000..7fbd5c19f3 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/get/index.html @@ -0,0 +1,81 @@ +--- +title: Map.prototype.get() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/get +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Map/get +original_slug: Web/JavaScript/Reference/Global_Objects/Map/get +--- +
{{JSRef}}
+ +

get() 메서드는 Map 객체에서 지정한 요소를 회수합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-get.html")}}
+ + + +

구문

+ +
myMap.get(key);
+ +

매개변수

+ +
+
key
+
Map 객체에서 회수할 요소의 키.
+
+ +

반환 값

+ +

주어진 키와 연결된 요소. 그런 요소가 없으면 {{jsxref("undefined")}}.

+ +

예제

+ +

get 사용하기

+ +
var myMap = new Map();
+myMap.set('bar', 'foo');
+
+myMap.get('bar');  // "foo" 반환.
+myMap.get('baz');  // undefined 반환.
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.get', 'Map.prototype.get')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.get', 'Map.prototype.get')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.get")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/has/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/has/index.html new file mode 100644 index 0000000000..8f3d1c475e --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/has/index.html @@ -0,0 +1,82 @@ +--- +title: Map.prototype.has() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/has +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/has +original_slug: Web/JavaScript/Reference/Global_Objects/Map/has +--- +
{{JSRef}}
+ +

has() 메서드는 주어진 키를 가진 요소가 Map에 존재하는지를 반환합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-has.html")}}
+ + + +

구문

+ +
myMap.has(key);
+ +

매개변수

+ +
+
key
+
존재 여부를 판별할 키값.
+
+ +

반환 값

+ +

주어진 키를 가진 요소가 있으면 true, 아니면 false.

+ +

예제

+ +

has() 사용하기

+ +
var myMap = new Map();
+myMap.set('bar', "foo");
+
+myMap.has('bar');  // returns true
+myMap.has('baz');  // returns false
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.has', 'Map.prototype.has')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.has', 'Map.prototype.has')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.has")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/index.html new file mode 100644 index 0000000000..32a5de42f7 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/index.html @@ -0,0 +1,245 @@ +--- +title: Map +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map +original_slug: Web/JavaScript/Reference/Global_Objects/Map +--- +
{{JSRef}}
+ +

Map 객체는 키-값 쌍을 저장하며 각 쌍의 삽입 순서도 기억하는 콜렉션입니다. 아무 값(객체와 {{Glossary("Primitive", "원시 값")}})이라도 키와 값으로 사용할 수 있습니다.

+ +

설명

+ +

Map 객체는 요소의 삽입 순서대로 원소를 순회합니다. {{jsxref("Statements/for...of", "for...of")}} 반복문은 각 순회에서 [key, value]로 이루어진 배열을 반환합니다.

+ +

키 동일성

+ + + +

{{jsxref("Object")}}와 Map 비교

+ +

{{jsxref("Object")}}는 값에 키를 할당할 수 있고, 그 키로 값을 얻을 수 있고, 키를 삭제할 수 있으며 어떤 키에 값이 존재하는지 확인할 수 있다는 점에서 Map과 유사합니다. 이런 이유에 더해, 이전에는 내장된 대체제가 없었기 때문에, ObjectMap 대신 사용하곤 했습니다.

+ +

그러나 어떤 상황에선, Map을 선호해야 할 몇 가지 중요한 차이점이 있습니다.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MapObject
의도치 않은 키Map은 명시적으로 제공한 키 외에는 어떤 키도 가지지 않습니다. +

Object는 프로토타입을 가지므로 기본 키가 존재할 수 있습니다. 주의하지 않으면 직접 제공한 키와 충돌할 수도 있습니다.

+ +
+

참고: ES5부터, 프로토타입으로 인한 키 충돌은 {{jsxref("Object.create", "Object.create(null)")}}로 해결할 수 있지만, 실제로 쓰이는 경우는 적습니다.

+
+
키 자료형Map의 키는 함수, 객체 등을 포함한 모든 값이 가능합니다.Object의 키는 반드시 {{jsxref("String")}} 또는 {{jsxref("Symbol")}}이어야 합니다.
키 순서 +

Map의 키는 정렬됩니다. 따라서 Map의 순회는 삽입순으로 이뤄집니다.

+
+

Object의 키는 정렬되지 않습니다.

+ +
+

참고: ECMAScript 201 이후로, 객체도 문자열과 Symbol 키의 생성 순서를 유지합니다. ECMEScript 2015 명세를 준수하는 JavaScript 엔진에서 문자열 키만 가진 객체를 순회하면 삽입 순을 따라갑니다.

+
+
크기Map의 항목 수는 {{jsxref("Map.prototype.size", "size")}} 속성을 통해 쉽게 알아낼 수 있습니다.Object의 항목 수는 직접 알아내야 합니다.
순회Map순회 가능하므로, 바로 순회할 수 있습니다.Object를 순회하려면 먼저 모든 키를 알아낸 후, 그 키의 배열을 순회해야 합니다.
성능잦은 키-값 쌍의 추가와 제거에서 더 좋은 성능을 보입니다.잦은 키-값 쌍의 추가와 제거를 위한 최적화가 없습니다.
+ +

생성자

+ +
+
{{jsxref("Map.Map", "Map()")}}
+
새로운 Map 객체를 생성합니다.
+
+ +

속성

+ +
+
Map.length
+
값이 0인 속성입니다.
+ 요소의 수는 {{jsxref("Map.prototype.size")}}로 알아낼 수 있습니다.
+
{{jsxref("Map.@@species", "get Map[@@species]")}}
+
파생 객체를 생성하는데 사용하는 생성자 함수입니다.
+
{{jsxref("Map.prototype")}}
+
Map 생성자의 프로토타입을 나타냅니다. 모든 Map 인스턴스에 속성을 추가할 수 있습니다.
+
+ +

Map 인스턴스

+ +

모든 Map 인스턴스는 {{jsxref("Map.prototype")}}을 상속합니다.

+ +

속성

+ +

{{page('ko/Web/JavaScript/Reference/Global_Objects/Map/prototype','Properties')}}

+ +

메서드

+ +

{{page('ko/Web/JavaScript/Reference/Global_Objects/Map/prototype','Methods')}}

+ +

예제

+ +

Map 객체 사용하기

+ +
let myMap = new Map()
+
+let keyString = '문자열'
+let keyObj    = {}
+let keyFunc   = function() {}
+
+// 값 설정
+myMap.set(keyString, "'문자열'과 관련된 값")
+myMap.set(keyObj, 'keyObj와 관련된 값')
+myMap.set(keyFunc, 'keyFunc와 관련된 값')
+
+myMap.size              // 3
+
+// getting the values
+myMap.get(keyString)    // "'문자열'과 관련된 값"
+myMap.get(keyObj)       // "keyObj와 관련된 값"
+myMap.get(keyFunc)      // "keyFunc와 관련된 값"
+
+myMap.get('문자열')    // "'문자열'과 관련된 값"
+                         // keyString === '문자열'이기 때문
+myMap.get({})            // undefined, keyObj !== {}
+myMap.get(function() {}) // undefined, keyFunc !== function () {}
+ +

Map의 키로 NaN 사용하기

+ +

{{jsxref("NaN")}}도 키로서 사용할 수 있습니다. 모든 NaN은 자기 자신과 동일하지 않지만(NaN !== NaN), NaN을 서로 구분할 수도 없기 때문에 아래 예제도 잘 동작합니다.

+ +
let myMap = new Map()
+myMap.set(NaN, 'not a number')
+
+myMap.get(NaN)
+// "not a number"
+
+let otherNaN = Number('foo')
+myMap.get(otherNaN)
+// "not a number"
+ +

for..ofMap 순회하기

+ +

Mapfor..of 반복문을 사용해 순회할 수 있습니다.

+ +
let myMap = new Map()
+myMap.set(0, 'zero')
+myMap.set(1, 'one')
+
+for (let [key, value] of myMap) {
+  console.log(key + ' = ' + value)
+}
+// 0 = zero
+// 1 = one
+
+for (let key of myMap.keys()) {
+  console.log(key)
+}
+// 0
+// 1
+
+for (let value of myMap.values()) {
+  console.log(value)
+}
+// zero
+// one
+
+for (let [key, value] of myMap.entries()) {
+  console.log(key + ' = ' + value)
+}
+// 0 = zero
+// 1 = one
+ +

forEach()Map 순회하기

+ +

Map은 {{jsxref("Map.prototype.forEach", "forEach()")}} 메서드로 순회할 수 있습니다.

+ +
myMap.forEach(function(value, key) {
+  console.log(key + ' = ' + value)
+})
+// 0 = zero
+// 1 = one
+ +

Array 객체와의 관계

+ +
let kvArray = [['key1', 'value1'], ['key2', 'value2']]
+
+// Use the regular Map constructor to transform a 2D key-value Array into a map
+let myMap = new Map(kvArray)
+
+myMap.get('key1') // returns "value1"
+
+// Use Array.from() to transform a map into a 2D key-value Array
+console.log(Array.from(myMap)) // Will show you exactly the same Array as kvArray
+
+// A succinct way to do the same, using the spread syntax
+console.log([...myMap])
+
+// Or use the keys() or values() iterators, and convert them to an array
+console.log(Array.from(myMap.keys())) // ["key1", "key2"]
+ +

명세

+ + + + + + + + + + +
Specification
{{SpecName('ESDraft', '#sec-map-objects', 'Map')}}
+ +

브라우저 호환성

+ +

{{Compat("javascript.builtins.Map")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/map/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/map/index.html new file mode 100644 index 0000000000..8a384863bd --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/map/index.html @@ -0,0 +1,61 @@ +--- +title: Map() 생성자 +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/Map +tags: + - Constructor + - JavaScript + - Map + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/Map +original_slug: Web/JavaScript/Reference/Global_Objects/Map/Map +--- +
{{JSRef}}
+ +

Map() 생성자는 {{jsxref("Map")}} 객체를 생성합니다.

+ +

구문

+ +
new Map([iterable])
+ +

매개변수

+ +
+
iterable
+
요소가 키-값 쌍인, {{jsxref("Array")}} 또는 다른 순회 가능한 객체(예: [[1, 'one'], [2, 'two']]). 각 키-값 쌍은 새로운 Map에 포함됩니다.
+
+ +

예제

+ +
let myMap = new Map([
+  [1, 'one'],
+  [2, 'two'],
+  [3, 'three'],
+])
+
+ +

명세

+ + + + + + + + + + +
Specification
{{SpecName('ESDraft', '#sec-map-constructor', 'Map constructor')}}
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.Map")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/set/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/set/index.html new file mode 100644 index 0000000000..8a8907a278 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/set/index.html @@ -0,0 +1,97 @@ +--- +title: Map.prototype.set() +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/set +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/set +original_slug: Web/JavaScript/Reference/Global_Objects/Map/set +--- +
{{JSRef}}
+ +

set() 메서드는 Map 객체에서 주어진 키를 가진 요소를 추가하고, 키의 요소가 이미 있다면 대체합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-set.html")}}
+ + + +

구문

+ +
myMap.set(key, value);
+ +

매개변수

+ +
+
key
+
Map에 추가하거나 변경할 요소의 키.
+
value
+
Map에 추가하거나 변경할 요소의 값.
+
+ +

반환 값

+ +

호출한 Map 객체.

+ +

예제

+ +

set() 사용하기

+ +
var myMap = new Map();
+
+// Add new elements to the map
+myMap.set('bar', 'foo');
+myMap.set(1, 'foobar');
+
+// Update an element in the map
+myMap.set('bar', 'baz');
+
+ +

set() 체이닝

+ +

set()이 같은 Map을 반환하므로 메서드를 여러 번 연속해서 호출할 수 있습니다.

+ +
// Add new elements to the map with chaining.
+myMap.set('bar', 'foo')
+     .set(1, 'foobar')
+     .set(2, 'baz');
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-map.prototype.set', 'Map.prototype.set')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.set', 'Map.prototype.set')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.set")}}

+ +

같이 보기

+ + diff --git a/files/ko/orphaned/web/javascript/reference/global_objects/map/size/index.html b/files/ko/orphaned/web/javascript/reference/global_objects/map/size/index.html new file mode 100644 index 0000000000..acbb861542 --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/global_objects/map/size/index.html @@ -0,0 +1,63 @@ +--- +title: Map.prototype.size +slug: orphaned/Web/JavaScript/Reference/Global_Objects/Map/size +translation_of: Web/JavaScript/Reference/Global_Objects/Map/size +original_slug: Web/JavaScript/Reference/Global_Objects/Map/size +--- +
{{JSRef}}
+ +

size 접근자 프로퍼티는  {{jsxref("Map")}} 객체의 요소 갯수를 반환합니다.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-size.html")}}
+ + + +

설명

+ +

size 값은 얼마나 많은 엔트리를 Map 객체가 가지고 있는지를 표현합니다. size 를 설정할 수 있는 접근자 함수는 undefined 입니다. 당신은 이 프로퍼티를 변경할 수 없습니다.

+ +

예제

+ +

Using size

+ +
var myMap = new Map();
+myMap.set('a', 'alpha');
+myMap.set('b', 'beta');
+myMap.set('g', 'gamma');
+
+myMap.size // 3
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES2015', '#sec-get-map.prototype.size', 'Map.prototype.size')}}{{Spec2('ES2015')}}Initial definition.
{{SpecName('ESDraft', '#sec-get-map.prototype.size', 'Map.prototype.size')}}{{Spec2('ESDraft')}}
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Map.size")}}

+ +

더 보기

+ + -- cgit v1.2.3-54-g00ecf