blob: 495ad62882033dbcdc4be12ab4e556ffde448962 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// map.iterator() is live: entries added during iteration are visited.
var map = new Map();
function force(k) {
if (!map.has(k) && k >= 0)
map.set(k, k - 1);
}
force(5);
var log = '';
for (let [k, v] of map) {
log += k + ';';
force(v);
}
assertEq(log, '5;4;3;2;1;0;');
assertEq(map.size, 6);
|