JavaScript Try Catch Finally Return Statement

Quick JS Brain Teaser: What happens when you have return statements in try, catch, AND finally blocks? function testReturn() { try { return "try"; } catch (e) { return "catch"; } finally { return "finally"; } } console.log(testReturn()); What will be logged to the console? A) "try" B) "catch" C) "finally" D) undefined Does this match your expectations? Drop your answer and explain why! #JavaScript #JavaScriptInterviewQuestion #JavaScriptFundamentals

To view or add a comment, sign in

Explore content categories