1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
let proxy = new Proxy({ a: 1, b: 2, c: 3 }, { enumerate() { // Should not be invoked. assertEq(false, true); }, ownKeys() { return ['a', 'b']; } }); let object = Object.create(proxy); object.d = 4; let a = []; for (let x in object) { a.push(x); } assertEq(a.toString(), "d,a,b");