$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #209

What is the output?

const m = new Map<string, number>([['a', 1]]);
m.set('a', 2);
console.log(m.size, m.get('a'));
  1. 1 2
  2. 2 1
  3. 2 2
  4. 1 1
Setting an existing key overwrites its value instead of adding a second entry.
Play Problem Solving ▸