--- title: Map.prototype.entries() slug: Web/JavaScript/Reference/Global_Objects/Map/entries tags: - ECMAScript 2015 - JavaScript - Map - Method - Prototype - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Map/entries ---
{{JSRef}}

entries() 메서드는 Map 객체의 각 요소에 해당하는 [키, 값] 쌍을 Map에 등록한 순서대로 포함한 새로운 Iterator 객체를 반환합니다.

{{EmbedInteractiveExample("pages/js/map-prototype-entries.html")}}

구문

myMap.entries()

반환 값

A new {{jsxref("Map")}} iterator object.

예제

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"]

명세

Specification Status Comment
{{SpecName('ES2015', '#sec-map.prototype.entries', 'Map.prototype.entries')}} {{Spec2('ES2015')}} Initial definition.
{{SpecName('ESDraft', '#sec-map.prototype.entries', 'Map.prototype.entries')}} {{Spec2('ESDraft')}}  

브라우저 호환성

{{Compat("javascript.builtins.Map.entries")}}

같이 보기