代码示例:(标识:js_object_entries_map)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript 对象方法</h1>

<p>Object.entries() 使将对象转换为 Map 变得简单:</p>

<p id="demo"></p>

<script>
const fruits = {Bananas:300, Oranges:200, Apples:500}; 

const myMap = new Map(Object.entries(fruits));

document.getElementById("demo").innerHTML = myMap;
</script>

</body>
</html>
运行结果: