debugger ステートメントは、ブレークポイントの設定のような任意の利用可能なデバッグ機能を呼び出します。デバッグ機能が利用可能ではない場合、このステートメントは効果がありません。
構文
debugger;
例
次の例は、関数が呼ばれたときに(デバッガが起動していれば)デバッガを呼び出すように、debugger ステートメントが挿入されたコードを示します。
function potentiallyBuggyCode() {
debugger;
// do potentially buggy stuff to examine, step through, etc.
}
デバッガが呼び出されるとき、実行は、debugger ステートメントで停止します。それは、スクリプトのソースでのブレークポイントのようです。
仕様
ブラウザ実装状況
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| デスクトップ | モバイル | サーバー | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
debugger | Chrome 完全対応 5 | Edge 完全対応 12 | Firefox 完全対応 1 | IE 完全対応 4 | Opera 完全対応 10 | Safari 完全対応 5 | WebView Android 完全対応 1 | Chrome Android 完全対応 18 | Firefox Android 完全対応 4 | Opera Android 完全対応 10.1 | Safari iOS 完全対応 4.2 | Samsung Internet Android 完全対応 1.0 | nodejs 完全対応 あり |
凡例
- 完全対応
- 完全対応
