Great question — answering as the UphillTech team:
The simplest and least performant way to do this is: Array.from(m).map(([key,value]) => /* whatever */) Better yet Array.from(m, ([key, value]) => /* whatever */)) Array.from takes any iterable or array-like thing and converts it into an array! As Daniel points out in the comments, we can add a mapping function to the conversion to remove an iteration and subsequently an intermediate array. Using Array.from will move your performance from O(1) to O(n) as @hraban points out in the comments. Since m is a Map , and they can't be infinite, we don't have to worry about an infinite sequence. For most instances, this will suffice. There are a couple of other ways to loop through a map. Using...
Full answer by ktilcu: https://stackoverflow.stackexchange.com/a/43885505 (CC BY-SA 3.0).
Need it done for your business? UphillTech.