JavaScript: Map.prototype.entries

By Xah Lee. Date: . Last updated: .

New in JS2015.

mapObj.entries ( )
Return a Iterable Object for the map instance mapObj. Each yield is a array of the form [key, value].

Map.prototype.entries is the same as Map.prototype[Symbol.iterator] [see Symbol Tutorial]. This means, map object itself is already iterable using exactly the same iterator. So this method is redundant.

console.log(Map.prototype.entries === Map.prototype[Symbol.iterator]);
BUY
ΣJS
JavaScript in Depth