Metoda has()
zwraca Boolean, kt贸ry okre艣la czy element o podanym kluczu istnieje.
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.
Sk艂adnia
myMap.has(key);
Parametry
- key
- Wymagany. Klucz elementu, kt贸rego istnienie w
Mapie
zostanie sprawdzone.
Zwracana warto艣膰
- Boolean
-
true
, je艣li dany element istnieje wMapie
- w przeciwnym wypadkufalse
.
Przyk艂ady
U偶ywanie metody has
var myMap = new Map();
myMap.set('bar', "foo");
myMap.has('bar'); // zwraca true
myMap.has('baz'); // zwraca false
Specyfikacja
Specyfikacja | Status | Komentarz |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Map.prototype.has' in that specification. |
Standard | Initial definition. |
ECMAScript (ECMA-262) The definition of 'Map.prototype.has' in that specification. |
Living Standard |
Kompatybilno艣膰 z przegl膮darkami
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.