The entries()
method returns a new iterator object that contains the [key, value]
pairs for each element in the Map
object in insertion order. In this particular case, this iterator object is also an iterable, so the for-of loop can be used. When the protocol [Symbol.iterator]
is used, it returns a function that, when invoked, returns this iterator itself.