Map
.prototype
property는 Map
의 프로토 타입을 나타낸다.
Property attributes of Map.prototype |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Description
Map
instance는 Map.prototype
를 상속한다. Constructor의 프로토타입에 property와 method를 추가함으로써 모든 Map
인스턴스에서 사용 가능하게끔 만들 수 있다.
Properties
Map.prototype.constructor
- 인스턴스의 프로토타입을 만드는 함수를 반환한다. 이것
Map
함수의 기본 값이다. Map.prototype.size
Map
객체에 들어있는 key/value pair의 수를 반환한다.
Methods
Map.prototype.clear()
Map
객체의 모든 key/value pair를 제거한다.Map.prototype.delete(key)
- 주어진 키(Key)와 해당되는 값(Value)를 제거하고 제거하기 전에
Map.prototype.has(key)가 반환했던 값을 반환한다.
그 후의Map.prototype.has(key)는
false를 반환한다.
Map.prototype.entries()
Map
객체 안의 모든 요소들을[key, value] 형태의
array 로 집어넣은 순서대로 가지고 있는Iterator 객체를 반환한다.
Map.prototype.forEach(callbackFn[, thisArg])
Map
객체 안에 존재하는 각각의 key/value pair에 집어넣은 순서대로 callbackFn을 부른다. 만약 thisArg 매개변수가 제공되면, 이것이 각 callback의 this 값으로 사용된다.Map.prototype.get(key)
- 주어진 키(Key)에 해당되는 값(value)을 반환하고, 만약 없으면
undefined를 반환한다.
Map.prototype.has(key)
Map 객체 안에 주어진
key/value pair가 있는지 검사하고 Boolean 값을 반환한다.Map.prototype.keys()
Map
객체 안의 모든 키(Key)들을 집어넣은 순서대로 가지고 있는Iterator 객체를 반환한다.
Map.prototype.set(key, value)
Map 객체에 주어진 키
(Key)에 값(Value)를 집어넣고,Map 객체를 반환한다.
Map.prototype.values()
Map
객체 안의 모든 값(Value)들을 집어넣은 순서대로 가지고 있는Iterator 객체를 반환한다.
Map.prototype[@@iterator]()
Map
객체 안의 모든 요소들을[key, value] 형태의
array 로 집어넣은 순서대로 가지고 있는Iterator 객체를 반환한다.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Map.prototype' in that specification. |
Standard | Initial definition. |
ECMAScript (ECMA-262) The definition of 'Map.prototype' in that specification. |
Living Standard |
Browser compatibility
No compatibility data found. Please contribute data for "javascript.builtins.Map.prototype" (depth: 1) to the MDN compatibility data repository.