Last active
December 20, 2016 23:58
-
-
Save Arieg419/f4ed3ec394741bd21c1bc8db05d37fb0 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
var person = new Map(); | |
person.set("Formal Name", "Kanye West"); | |
person.set("Alias", "Yeezy"); | |
person.set("Goal", "GOAT"); // don't stop reading here! | |
console.log(person.has("Formal Name")) // true | |
console.log(person.size); // 3 | |
person.delete("Goal"); | |
console.log(person.has("Goal")); // false | |
console.log(person.size); // 2 | |
var result = person.get("Alias"); | |
console.log(result); // "Yeezy" | |
console.log(person.keys()); // "Formal Name", "Alias" | |
console.log(person.values()); // "Kanye West", "Yeezy" | |
console.log(person.entries()); // ["Formal Name", "Kanye West"], ["Alias", "Yeezy"] | |
person.clear(); | |
console.log(person.size); // 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment