← Quiz: Error Handling and Debugging: all 10 questions
Quiz: Error Handling and Debugging · Question 2 of 10
What does this print? (code)
What does this print?
function f() {
try { return "try"; }
finally { console.log("cleanup"); }
}
console.log(f());
- A.try
- B.cleanup
- C.cleanup try
- D.try cleanup
Answer & explanation
Correct answer: cleanup try
finally runs before the function actually returns, so "cleanup" prints first, then the returned "try".
Can you get the rest right without peeking?
Take the timed Quiz: Error Handling and Debugging quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →