Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Map.delete called while iterating #1

Open
Yaffle opened this Issue Oct 13, 2012 · 1 comment

Comments

Projects
None yet
1 participant

Yaffle commented Oct 13, 2012

see new ES draft about iteration and "delete"/"set"...

Yaffle commented Aug 14, 2013

test case:

(function () {
  var s = [];
  var value = 42;
  var map = new Map();
  map.set(0, value);
  map.set(1, value);
  map.set(2, value);
  map.set(3, value);
  map.delete(1);
  map.forEach(function (value, key) {
    s.push(key);
    if (key === 0) {
      map.delete(0);
      map.delete(2);
      map.set(4);
    }
  });
  alert(s.join(""));//should alert 034
}(self));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment