entriesbeginnerconst m = new Map([['a', 1], ['b', 2]])
for (const [key, val] of m.entries()) {
console.log(key, val) // 'a' 1, then 'b' 2
}Use Map.entries() to iterate over [key, value] pairs in insertion order.
entries() returns an iterator of [key, value] pairs.
Challenge: Verify that spreading entries() gives the correct array.