debugger
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
debugger
文は、ブレークポイントの設定などの任意の利用可能なデバッグ機能を呼び出します。デバッグ機能が利用可能ではない場合、この文は効果がありません。
構文
js
debugger;
例
debugger 文の使用
次の例は、関数が呼び出されたときに、デバッガーを(存在すれば)呼び出すように、 debugger
文が挿入されているコードを示します。
js
function potentiallyBuggyCode() {
debugger;
// do potentially buggy stuff to examine, step through, etc.
}
デバッガーが起動していると、実行は debugger
文で停止します。スクリプトのソース内でのブレークポイントと似ています。
仕様書
Specification |
---|
ECMAScript® 2025 Language Specification # sec-debugger-statement |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
debugger |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.