Question 19 of 10019%
19
What gets logged when this async function runs?
async function mayFail(shouldFail) {
if (shouldFail) {
throw new Error("failed");
}
return "success";
}
async function run() {
try {
const result = await mayFail(true);
console.log(result);
} catch (err) {
console.log("Caught:", err.message);
}
}
run();
19/100