WebStorm (2016.1) でのデバッグ中に、デバッガーがconsole.log(arguments). 次に例を示します。
function breakDebug() {
console.log(arguments);
}
breakDebug();
console.log("still kickin'"); // WS will not stop on breakpoint here
これは、次のように、呼び出し側でargumentsデバッガーを詰まらせない型 (arrayなど) に変換することで解決できます。object
function digestible(args) {
return Array.prototype.slice.call(args);
}
function breakDebug() {
console.log(digestible(arguments)); // this is cumbersome
}
breakDebug();
console.log("still kickin'"); // this time debugger stops
// on breakpoint here
console引数を明示的に配列に変換する代わりに、最初のスニペットがデバッガーを壊さないようにするオブジェクトに対して実行できる安全なブードゥーはありますか? 安全とは、私のような JS 初心者が知らないすべてのベスト プラクティスに準拠していることを意味します。
余談ですが、これを JetBrains に報告する必要がありますか?