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

What is the output?

const m = new Map([[1, 'a']]);
console.log(m.get('1'), m.get(1));
  1. undefined a
  2. a a
  3. a undefined
  4. undefined 1
Map keys are compared by SameValueZero, so the string '1' and the number 1 are different keys.
Play Problem Solving ▸