How does a return statement inside a try/catch block work?
function example() { try { return true; } finally { return false;
Returning from a finally-block If the finally-block returns a value, this value becomes the return value of the entire try-catch-finally statement, regardless of any return statements in the try and catch-blocks
Returning from a finally-block
If the finally-block returns a value, this value becomes the return value of the entire try-catch-finally statement, regardless of any return statements in the try and catch-blocks
finally
try-catch-finally
return
try
catch
Reference: developer.mozilla.org