1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
var causeOSI = true; function rec(x, self) { if (x === 0 || x !== x) { if (causeOSI) { causeOSI = false; self(NaN, self) causeOSI = true; } return; } self(x - 1, self); } // Use enough iterations to type infer the script. causeOSI = false; for (var i = 0; i < 20; ++i) rec(1, rec); causeOSI = true; rec(2, rec)