Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 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 Respostas
+ 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