Die get()
Methode gibt eine Spezielles Element aus 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.
Syntax
myMap.get(schlüssel);
Parameter
- schlüssel
- Der Schlüssel eines Elements, welches aus der
Map
zurückgegeben wird.
Rückgabewert
Gibt das Element zurück, welches zu dem Schlüssel gehört oder undefined
, wenn kein Schlüssel in dem Map
Objekt vorhanden ist.
Beispiele
Einsatz der get Methode
var myMap = new Map();
myMap.set('bar', 'foo');
myMap.get('bar'); // Returns "foo".
myMap.get('baz'); // Returns undefined.
Spezifikationen
Spezifikation | Status | Kommentar |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Die Definition von 'Map.prototype.get' in dieser Spezifikation. |
Standard | Initiale Definition. |
ECMAScript (ECMA-262) Die Definition von 'Map.prototype.get' in dieser Spezifikation. |
Lebender Standard |
Browserkompatibilität
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.