Metoda entries()
zwraca nowy obiekt typu Iterator który zawiera pary[klucz, wartość]
dla każdego elementu Mapy
. Można się do nich odnieść w takiej kolejności, jakiej zostały wstawione.
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.entries()
Zwracana wartość
Nowy iterator obiektu typu Map
.
Przykłady
Używanie entries()
var myMap = new Map();
myMap.set('0', 'foo');
myMap.set(1, 'bar');
myMap.set({}, 'baz');
var mapIter = myMap.entries();
console.log(mapIter.next().value); // ["0", "foo"]
console.log(mapIter.next().value); // [1, "bar"]
console.log(mapIter.next().value); // [Object, "baz"]
Specyfikacja
Specyfikacja | Status | Komentarz |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Map.prototype.entries' in that specification. |
Standard | Początkowa definicja. |
ECMAScript (ECMA-262) The definition of 'Map.prototype.entries' in that specification. |
Living Standard |
Kompatybilność z przeglądarkami
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 38 | (Yes) | 20 (20) | No support | 25 | 7.1 |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | No support | 38 | (Yes) | 20.0 (20) | No support | No support | 8 |