In JavaScript development, I frequently return from execution to have an inartificial breakpoint:
var args = arguments;
return console.log(args); // debug
criticalProcessing(args);
Chrome and others are okay with it, but unfortunately for debugging in Firefox:
Starting with Gecko 40 (Firefox 40 / Thunderbird 40 / SeaMonkey 2.37), a warning is shown in the console if unreachable code is found after a return statement.
Firefox’ about:config
provides quite some flags to adjust the development environment. Sadly, I didn’t find a corresponding setting (nor a solution elsewhere).
Is there a way to turn of the “unreachable code after return statement” warning?
The only way I know of getting around this warning is to put a condition that's always true in the return line:
function myFun() {
var args = arguments;
if (1) return console.log(args);
// unreachable code goes here
criticalProcessing(args);
}