1 2 3 4 5 6 7 8 9 10 11
// set.iterator() is live: entries added during iteration are visited. var set = new Set([5]); var log = ''; for (let x of set) { log += x + ';'; if (x > 0) set.add(x - 1); } assertEq(log, '5;4;3;2;1;0;'); assertEq(set.size, 6);