1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
function TestObject(a) { this.a = 1; if (a >= 0) { this.b = 2; } if (a > 0) { new TestObject(a - 1); } } // Force analysis. There may be a better way. for (let i = 0; i < 1000; i++) { new TestObject(-1); } let x = new TestObject(1); assertEq(x.a, 1); assertEq(x.b, 2);