📌  相关文章
📜  将地图转换为对象 JSON javascript 代码示例

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

代码示例1
const map1 = new Map([
  ['foo', 'bar'],
  ['baz', 42]
]);

const obj = Object.fromEntries(map1);
// { foo: 'bar', baz: 42 }

//To get back the map:
const map2 = new Map(Object.entries(obj));