1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
function throwSomething() { throw "something"; } try { // Use eval to force BINDNAME. Should throw "something" instead of the TDZ // ReferenceError. eval("x = throwSomething()"); let x; } catch (e) { assertEq(e, "something"); } try { eval("x = 42"); let x; } catch (e) { assertEq(e instanceof ReferenceError, true); }