Open this example in the interactive library
Source code
const user = { id: 1 },
map = new Map([[user, "active"]]);
console.log(map.get(user));
Sample output
active

Store object keys in a Map. A self-contained example using the JavaScript runtime.
Open this example in the interactive library
const user = { id: 1 },
map = new Map([[user, "active"]]);
console.log(map.get(user));
active