debugger
Składnia
Wyrażenie debugger uruchamia dowolną dostępną funkcjonalność umożliwiającą debuggowanie, przykładowo poprzez ustawienie breakpointa w miejscu użycia wyrażenia. Jeżeli żadna tego typu funkcjonalność nie jest dostępna, użycie wyrażenia nie ma wpływu na działanie programu.
debugger;
Przykłady
Poniższy przykład pokazuje użycie wyrażenia debugger w celu uruchomienia debuggera w momencie wywołania funkcji (jeżeli jest dostępny).
function potentiallyBuggyCode() {
debugger;
// przeprowadź analizę działania programu zawierających bugi, przejdź do kolejnych wywołań, itp.
}
Kiedy następuje wywołanie instrukcji debugger, uruchomienie programu zatrzymywane jest na wyrażeniu debugger. Działa to tak jak ustawienie breakpointu w kodzie źródłowym skryptu.
Specyfikacje
Specyfikacja | Status | Komentarz |
---|---|---|
ECMAScript (ECMA-262) The definition of 'Debugger statement' in that specification. |
Living Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Debugger statement' in that specification. |
Standard | |
ECMAScript 5.1 (ECMA-262) The definition of 'Debugger statement' in that specification. |
Standard | Wstępna definicja |
ECMAScript 3rd Edition (ECMA-262) The definition of 'Debugger statement' in that specification. |
Standard | |
ECMAScript 1st Edition (ECMA-262) The definition of 'Debugger statement' in that specification. |
Standard | Jedynie wspomniane jako zarezerwowane słowo kluczowe |
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Cecha | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Podstawowe wsparcia | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Cecha | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Podstawowe wsparcie | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |