<!DOCTYPE html>
<html>
<head>
<title>document.write() Example</title>
</head>
<body>
<script type="text/javascript">
const map = new Map();
const weakmap = new WeakMap();
(function() {
const foo = {foo: 1};
const bar = {bar: 2};
map.set(foo, 1);
weakmap.set(bar, 2);
})()
console.log(map.keys)
console.log(weakmap.keys)
console.log(map.foo)
console.log(weakmap.bar)
console.log(map)
console.log(weakmap)
</script>
</body>
</html>
ƒ keys() { [native code] }
09:39:42.826 43.html:20 undefined
09:39:42.826 43.html:21 undefined
09:39:42.826 43.html:22 undefined
09:39:42.826 43.html:23 Map(1)
09:39:42.826 43.html:24 WeakMap