I'm doing try and catch exercises in JavaScript.
here is my code
function getTime1() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(11111);
}, 1000);
});
}
function getTime2() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(22222);
}, 1000);
});
}
async function funB() {
// try {
let b = await getTime2();
throw "B error";
// } catch (e) {
// console.log("this" + e);
// }
}
async function funA() {
try {
let a = await getTime1();
funB();
} catch (e) {
console.log("that" + e);
}
}
funA();
and here is the result
Uncaught (in promise) B error
I want to know why there is no catch in funb and Funa. Thank you