<!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)
console.log(weakmap)
</script>
</body>
</html>
<!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.bar)
</script>
</body>
</html>
43.html:19 ƒ keys() { [native code] }
15:06:07.829 43.html:20 undefined