Q: ES6 map.keys () after map.delete (key)

when i try this 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 the following:

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

"b" why not show?

+5
source share
1 answer

These are browser compatibility issues that occur with map.keys() , map.values() , map.entries() .

The problem occurs in chrome when deleting the first key, but it works when it is in safari .

Also, these properties do not even work in Mozilla , just returns an empty map iterator

0
source

Source: https://habr.com/ru/post/1274305/