1 2 3 4 5 6 7 8 9 10 11
// Iterating over a set of objects yields those exact objects. var arr = [{}, {}, {}, [], /xyz/, new Date]; var set = new Set(arr); assertEq(set.size, arr.length); var i = 0; for (var x of set) assertEq(x, arr[i++]); assertEq(i, arr.length);