size
접근자 프로퍼티는 Map
객체의 요소 갯수를 반환합니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
설명
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
명세
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Map.prototype.size' in that specification. |
Standard | Initial definition. |
ECMAScript (ECMA-262) The definition of 'Map.prototype.size' in that specification. |
Living Standard |
브라우저 호환성
BCD tables only load in the browser