--- title: Map.prototype.get() slug: Web/JavaScript/Reference/Global_Objects/Map/get tags: - ECMAScript 2015 - JavaScript - Map - Method - Prototype translation_of: Web/JavaScript/Reference/Global_Objects/Map/get ---
get()
메서드는 Map
객체에서 지정한 요소를 회수합니다.
myMap.get(key);
key
Map
객체에서 회수할 요소의 키.주어진 키와 연결된 요소. 그런 요소가 없으면 {{jsxref("undefined")}}.
get
사용하기var myMap = new Map(); myMap.set('bar', 'foo'); myMap.get('bar'); // "foo" 반환. myMap.get('baz'); // undefined 반환.
Specification | Status | Comment |
---|---|---|
{{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")}}