Do you know what will be the output of this code?
JavaScript
const map = new Map();
map.set(1, "number");
map.set("1", "string");
console.log(map.size);
Show answer and explanation
The answer is 2.
Map compares keys with SameValueZero, so the number 1 and the string "1" are different keys. A plain object would convert both to "1".