michael@0: // Array.of does not trigger prototype setters. michael@0: // (It defines elements rather than assigning to them.) michael@0: michael@0: var status = "pass"; michael@0: Object.defineProperty(Array.prototype, "0", {set: v => status = "FAIL 1"}); michael@0: assertEq(Array.of(1)[0], 1); michael@0: assertEq(status, "pass"); michael@0: michael@0: function Bag() {} michael@0: Bag.of = Array.of; michael@0: Object.defineProperty(Bag.prototype, "0", {set: v => status = "FAIL 2"}); michael@0: assertEq(Bag.of(1)[0], 1); michael@0: assertEq(status, "pass");