1 2 3 4 5 6 7 8 9
function assert(x) { if (!x) throw 1; } try { var nan = undefined + 1; assert(nan + "" == "NaN"); console.log("PASS"); } catch (e) { console.log("FAIL: " + e); }