--- title: Map.prototype.has() slug: Web/JavaScript/Reference/Global_Objects/Map/has tags: - ECMAScript 2015 - JavaScript - Map - Method - Prototype - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Map/has ---
has()
메서드는 주어진 키를 가진 요소가 Map
에 존재하는지를 반환합니다.
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
Specification | Status | Comment |
---|---|---|
{{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")}}