const m = new Map(); const o = {p: ‘Hello World‘}; m.set(o, ‘content‘) m.get(o) // "content" m.has(o) // true m.delete(o) // true m.has(o) // false
const map = new Map([ [‘name‘, ‘张三‘], [‘title‘, ‘Author‘] ]); map.size // 2 map.has(‘name‘) // true map.get(‘name‘) // "张三" map.has(‘title‘) // true map.get(‘title‘) // "Author"
原文:https://www.cnblogs.com/150536FBB/p/13717025.html