--- title: debugger slug: Web/JavaScript/Reference/Statements/debugger tags: - JavaScript - Language feature - Statement translation_of: Web/JavaScript/Reference/Statements/debugger ---
debugger 文は、ブレークポイントの設定のような任意の利用可能なデバッグ機能を呼び出します。デバッグ機能が利用可能ではない場合、この文は効果がありません。
debugger;
次の例は、関数が呼び出されたときに、デバッガーを (存在すれば) 呼び出すように、 debugger 文が挿入されているコードを示します。
function potentiallyBuggyCode() {
debugger;
// do potentially buggy stuff to examine, step through, etc.
}
デバッガーが起動していると、実行は debugger 文で停止します。スクリプトのソース内でのブレークポイントと似ています。
| 仕様書 |
|---|
| {{SpecName('ESDraft', '#sec-debugger-statement', 'Debugger statement')}} |
{{Compat("javascript.statements.debugger")}}