fork download
  1. // your code goes here
  2. const m = new Map();
  3. m.set(1, 'a');
  4. m.set(2, 'b');
  5. //console.log([1,2,3].map(m.get)); // error
  6. console.log([1,2,3].map(m.get.bind(m)));
  7. console.log([1,2,3].map((x) => m.get(x)));
Success #stdin #stdout 0.03s 18804KB
stdin
Standard input is empty
stdout
a,b,
a,b,