📜  如何在 js 中循环遍历地图 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:54.748000             🧑  作者: Mango

代码示例3
var myMap = new Map();
myMap.set("0", "foo");
myMap.set(1, "bar");
myMap.set({}, "baz");

for (const [key, value] of Object.entries(myMap)) {
  console.log(key, value);
}