JavaScript Map entries()

Definition and usage

entries() The method returns an iterator object that contains [key, value] pairs in the Map.

entries() The method does not change the original Map.

instance

// Create a Map
const fruits = new Map([
  ["apples", 500],
  ["bananas", 300],
  ["oranges", 200]
]);
// List all entries
let text = "";
for (const x of fruits.entries()) {
  text += x;
}

Try it yourself

Syntax

map.entries()

Parameter

None.

Return value

Type Description
Iterator An iterable object that contains [key, value] pairs in the Map.

Browser support

map.entries() Is a feature of ECMAScript6 (ES6).

Starting from June 2017, all modern browsers support ES6 (JavaScript 2015):

Chrome Edge Firefox Safari Opera
Chrome 51 Edge 15 Firefox 54 Safari 10 Opera 38
May 2016 April 2017 June 2017 September 2016 June 2016

map.entries() Not Supported in Internet Explorer.