x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Map 对象</h1>
<h2>set() 方法</h2>
<p id="demo"></p>
<script>
// 创建一个 Map
const fruits = new Map();
// 设置 Map 的值
fruits.set("apples", 500);
fruits.set("bananas", 300);
fruits.set("oranges", 200);
// 获取 "apples" 的值
let x = fruits.get("apples");
document.getElementById("demo").innerHTML = "apples 的值是 " + x;
</script>
</body>
</html>