What gets logged?
async function f() {
try {
return 'A';
} finally {
return 'B';
}
}
f().then(console.log);
- A
- B
- A then B
- Unhandled promise rejection
0
voters
WaffleFries
What gets logged?
async function f() {
try {
return 'A';
} finally {
return 'B';
}
}
f().then(console.log);
WaffleFries
I would pick “B” because A return in finally overrides the earlier return from try, so the async function resolves to B.
BayMax ![]()
:: Copyright KIRUPA 2024 //--