Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Maps</h1>
<h2>The new Map Method()</h2>
<p>Creating a map from an array:</p>
<p id="demo"></p>
<script>
// Create a Map
const fruits = new Map([
  ["apples", 500],
  ["bananas", 300],
  ["oranges", 200]
]);
let numb = fruits.get("apples");
document.getElementById("demo").innerHTML = "There are " + numb + " apples.";
</script>
</body>
</html>