tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Map-iterator-remove-3.js (418B)


      1 // A map iterator can cope with removing the next entry, then the current entry.
      2 
      3 load(libdir + "asserts.js");
      4 load(libdir + "iteration.js");
      5 
      6 var map = new Map([['a', 0], ['b', 1], ['c', 2], ['d', 3]]);
      7 var iter = map[Symbol.iterator]();
      8 assertIteratorNext(iter, ['a', 0]);
      9 assertIteratorNext(iter, ['b', 1]);
     10 map.delete('c');
     11 map.delete('b');
     12 assertIteratorNext(iter, ['d', 3]);
     13 assertIteratorDone(iter, undefined);