6

when I try these code:

const map=new Map([['a', 1],['b', 2],['c', 3],['d', 4],['e', 5]]);
console.log(map.keys());
map.delete('a')
console.log(map.keys());

the chrome console will show these:

MapIterator {"a", "b", "c", "d", "e"}
MapIterator {"c", "d", "e"}

"b" why not show up?

俞常爽
  • 61
  • 1

1 Answers1

1

This is a browser compatibility issues, that happens with map.keys(), map.values(), map.entries().

The issue occurs in chrome when deleting the first key but it works when well in safari.

Also these properties don't even work in Mozilla, just returns an empty Map iterator

Shubham Khatri
  • 270,417
  • 55
  • 406
  • 400