JS: Map.prototype.entries

By Xah Lee. Date: . Last updated: .

(new in JS: ECMAScript 2015)

mapObj.entries()
  • Return a Generator for the map.
  • Each yield is a array of the form [key, value].
  • Map.prototype.entries is the same as Map.prototype[Symbol.iterator]
  • 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]);

JS Map.prototype