<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let set = new WeakSet()
let key = {}
set.add(key)
console.log(set.has(key)) //true
key = { a: 1 } //移除了key的第一个引用,添加了新的引用
console.log(set.has(key)) //false, Weak Set中的引用也自动移除
</script>
</body>
</html>