tor-browser

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

Map-values-2.js (575B)


      1 // map.keys() and map.values() return iterators over the key or the value,
      2 // respectively, of each key-value pair in the map.
      3 
      4 load(libdir + "iteration.js");
      5 
      6 var data = [["one", 1], ["two", 2], ["three", 3], ["four", 4]];
      7 var m = new Map(data);
      8 
      9 var ki = m.keys();
     10 assertIteratorNext(ki, "one");
     11 assertIteratorNext(ki, "two");
     12 assertIteratorNext(ki, "three");
     13 assertIteratorNext(ki, "four");
     14 assertIteratorDone(ki, undefined);
     15 
     16 assertDeepEq([...m.keys()], ["one", "two", "three", "four"]);
     17 assertDeepEq([...m.values()], [1, 2, 3, 4]);
     18 assertDeepEq([...m.entries()], data);