+ 15
I adore JS😀👍
function fu_n_ck() { try { return "I'm lost..."; } finally { return "HaHa!"; } }; fu_n_ck(); // "HaHa!" Overwritten return statement?! Please, explain inner logic.
2 Answers
+ 4
if the finally block returns a value, this value becomes the return value of the entire try-catch-finally production, regardless of any return statements in the try and catch blocks.
it's a peculiarity of JS... other programming languages doesn't allow return in the finally block.
- 1
lol...I love J.S ...its an amazing and free lan