Skip to content
RED SAGSkills
medium10 pts · first answer countsjavascriptobjectsmaps

Objects as keys in a plain object

What does this print?

const cache = {}
const a = { id: 1 }
const b = { id: 2 }
cache[a] = "first"
cache[b] = "second"
console.log(cache[a])
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions