Map的键可以是任意类型。
set:
1 let obj={name:"zy",age:500}; 2 let m=new Map(); 3 const bigInt = 1234567890123456789012345678901234567890n; 4 let id=Symbol("id"); 5 m.set(true,2);//布尔 6 m.set(null,2);//空 7 m.set("fly",2);//字符串 8 m.set(1,2);//数字 9 m.set(undefined,2);//未定义 10 m.set(obj,2);//对象 11 m.set(bigInt,2);//bigInt 12 m.set(id,2);//Symbol 13 console.log(m);