<html>
<body>
<h1>JavaScript Map.size 属性</h1>
<p>Map.size 属性返回 Map 中元素的数量</p>
<pre id="demo"></pre>
<script>
// 创建对象
const apples = {name: 'Apples'};
const bananas = {name: 'Bananas'};
const oranges = {name: 'Oranges'};
// 创建新的 Map
const fruits = new Map();
// Add new Elements to the Map
fruits.set(apples, 500);
fruits.set(bananas, 300);
fruits.set(oranges, 200);
document.getElementById("demo").innerHTML = "当前Map对象有 " + fruits.size + " 个元素";
</script>
</body>
</html>