hffhhf
Sat Sep 09 2023 11:00:42 GMT+0000 (Coordinated Universal Time)
Saved by
@artemhoriuk
#javascript
function* gen() {
try {
let result = yield "2 + 2 = ?"; // (1)
alert("The execution does not reach here, because the exception is thrown above");
} catch(e) {
alert(e); // shows the error
}
}
let generator = gen();
let question = generator.next().value;
generator.throw(new Error("The answer is not found in my database")); // (2)
content_copyCOPY
Comments