728x90
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 messages = [ | |
{text: "Hello", from: "John"}, | |
{text: "How goes?", from: "John"}, | |
{text: "See you soon", from: "Alice"} | |
]; | |
const messageReadDates = new WeakMap(); | |
messageReadDates.set(messages[0], new Date()); | |
messageReadDates.set(messages[1], new Date()); | |
console.log(messageReadDates.get(messages[0])); | |
console.log(messageReadDates.get(messages[1])); |
'Algorithm > JavaScript(Node.js)' 카테고리의 다른 글
The Modern JS Tutorial: Destructuring Assignment: The maximal salary (0) | 2021.10.25 |
---|---|
The Modern JS Tutorial: Destructuring Assignment: destructuring assignment (0) | 2021.10.25 |
The Modern JS Tutorial: WeakMap and WeakSet: Store "unread" flags (0) | 2021.10.20 |
The Modern JS Tutorial: Map and Set: iterable keys (0) | 2021.10.06 |
The Modern JS Tutorial: Map and Set: filter anagrams (0) | 2021.10.06 |