Javascript Maps

JavaScript Maps

ES6 now offers Maps, another list type that offers an infrastructure to manage collections of data with name/value pairs.

USAGE: Copy and paste the code samples below into the Javascript console in your browser, then simply hit return on your keyboard to see the code in action.

let card_ace = {
  name: "Ace of Spades"
let card_king = {
  name: "King of Clubs"

let deck = new Map();
deck.set("as", card_ace);
deck.set("kc", card_king);

//deck.size; deck.get('kc'); deck.delete('as'); deck.clear(); deck.keys()

for (key of deck.keys()) {

for (value of deck.values()) {

for (entry of deck.entries()) {

Link your website to this page! Copy and paste the URL below:
Copyright 2019. All Rights Reserved.