Last active
October 18, 2020 08:43
Map & set blog - Map overwrite
This file contains 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
let contacts = new Map(); | |
contacts.set('Duncan', '1234'); | |
contacts.set('Duncan', '2345'); // Will overwrite | |
if (!contacts.has('Duncan')) { | |
contacts.set('Duncan', '3456'); // Won't be called | |
} | |
console.log(contacts); // Map { 'Duncan' => '2345' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment