function shouldBe(actual, expected) { | |
if (actual !== expected) | |
throw new Error('bad value: ' + actual); | |
} | |
var error = null; | |
try { | |
var charAt = String.prototype.charAt; | |
charAt(); | |
} catch (e) { | |
error = e; | |
} | |
shouldBe(String(error), `TypeError: Type error`); | |
function refer() { charAt; } |