Created
April 30, 2017 12:18
-
-
Save kopylovvlad/f9aa63e308e7faf6e7afa657781204b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
let groceryList = new Map() | |
groceryList.set('Bananas', 6) | |
groceryList.set('Apples', 12) | |
groceryList.set('Grapes', 2) | |
groceryList.set('Kiwis', 10) | |
groceryList.set('Pears', 8) | |
console.log(groceryList.get('Kiwis') === 10) | |
console.log(groceryList.size === 5) | |
for (let [ key, val ] of groceryList.entries()) | |
console.log(`${key} = ${val}`) | |
groceryList.delete('Apples') | |
console.log(groceryList.size === 4) | |
console.log(...groceryList.values()) | |
console.log(...groceryList.keys()) | |
groceryList.clear() | |
console.log(groceryList.size === 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment