Ai
1 Star 0 Fork 0

zhengmin/ES6

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
map.html 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
zhengmin 提交于 2022-04-02 21:27 +08:00 . es6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// const m = new Map();
// const o = { p: 'Hello World' };
// m.set(o, 'content')
// console.log(m.get(o));//content
// const map = new Map();
// const k1 = ['a'];
// const k2 = ['a'];
// map.set(k1, 111).set(k2, 222);
// console.log(map.get(k1));
// // 111
// console.log(map.get(k2));
// // 222
// // const map = new Map();
// // // const k1 = ['a'];
// // // const k2 = ['a'];
// // map.set(['a'], 111).set(['a'], 222);
// // console.log(map.get(['a']));
// // // undefined
// // console.log(map.get(['a']));
// // // undefined
// var h = ["hello"];
// map.set(h, 20)
// console.log(map.get(['hello']));//undefined
// var h = ["hello"];
// map.set(h, 20)
// console.log(map.get(h));//20
const map = new Map();
map.set(['hello'], 10);
var h = ["hello"];
map.set(h, 20)
console.log(map.get(h));//20
console.log(map.get(['hello']));//undefined
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wzm_love_coding/es6.git
git@gitee.com:wzm_love_coding/es6.git
wzm_love_coding
es6
ES6
master

搜索帮助