在 JavaScript 开发中,我经常从执行中返回一个非人为的断点:
var args = arguments;
return console.log(args); // debug
criticalProcessing(args);
Chrome 和其他人都可以,但不幸的是在 Firefox 中进行调试:
从 Gecko 40 (Firefox 40/Thunderbird 40/SeaMonkey 2.37( 开始,如果在返回语句后发现无法访问的代码,控制台中会显示警告。
Firefox 的about:config
提供了相当多的标志来调整开发环境。可悲的是,我没有找到相应的设置(也没有其他地方的解决方案(。
有没有办法打开"返回语句后代码无法访问"警告?
我知道绕过
此警告的唯一方法是在返回行中放置一个始终为真的条件:
function myFun() {
var args = arguments;
if (1) return console.log(args);
// unreachable code goes here
criticalProcessing(args);
}