What is the output?
function f() {
try { return 1; } finally { return 2; }
}
console.log(f());
- 2
- 1
- undefined
- SyntaxError
A return inside finally overrides the one from try.
Play Problem Solving ▸
function f() {
try { return 1; } finally { return 2; }
}
console.log(f());