News for hackers. Stuff that matters.
Re:In JS functions, the ‘last’ return wins by lucideer on Saturday July 03, 2021 @11:25AM (#27722208)
> The same happens in Java and Python too.

And yet, I expect this will soon appear in those "JS is weird, wtf" listicles.

Re:In JS functions, the ‘last’ return wins by whoisthemachine on Saturday July 03, 2021 @11:28AM (#27722233)
C# does not allow returns from a `finally` block, which has annoyed me at times. However, seeing the consequences of allowing the behavior realized in this article, I am happy for the rule.
Re:In JS functions, the ‘last’ return wins by masklinn on Saturday July 03, 2021 @01:01PM (#27723039)
> C# does not allow returns from a `finally` block

I think C# does not allow any flow control in finally blocks, so no continue or break either (well for continue and break they're allowed if the statement they "refer to" is also in the finally block, but flow control can't go through or escape from the block).

Essentially in C# a finally block can only be escaped from by falling off of the block's end.

Re:In JS functions, the ‘last’ return wins by karldcampbell on Saturday July 03, 2021 @01:31PM (#27723272)
Doesn't javac issue a warning for this? I know most IDEs do.