Die size
Zugriffseigenschaft gibt die Anzahl der Elemente in einem Map
Objekt zurück.
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.
Beschreibung
Der Wert von size
ist eine ganze Zahl, die angibt, wie viele Einträge ein Map
Objekt hat. Die set-Zugriffsfunktion für size
ist undefined
; diese Eigenschaft kann nicht geändert werden.
Beispiele
Einsatz von size
var myMap = new Map();
myMap.set('a', 'alpha');
myMap.set('b', 'beta');
myMap.set('g', 'gamma');
myMap.size // 3
Spezifikationen
Spezifikation | Status | Kommentar |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Die Definition von 'Map.prototype.size' in dieser Spezifikation. |
Standard | Initiale Definition. |
ECMAScript (ECMA-262) Die Definition von 'Map.prototype.size' in dieser Spezifikation. |
Lebender Standard |
Browserkompatibilität
BCD tables only load in the browser