debugger 문은 중단점 설정 등 현재 사용할 수 있는 디버그 기능을 호출합니다. 사용할 수있는 디버깅 기능이 없으면 아무런 동작도 하지 않습니다.
구문
debugger;
예제
다음 예제에서는 함수가 호출 시 디버거를 활성화하도록 debugger를 삽입한 모습입니다.
function potentiallyBuggyCode() {
debugger;
// 버그가 있을 것으로 생각하는 코드를 분석하거나, 한 단계씩 진행해보거나...
}
디버거가 활성화되면 디버거 문의 위치에서 실행이 일시중지됩니다. 스크립트 소스의 중단점과 비슷합니다.
명세
| Specification | Status | Comment |
|---|---|---|
| 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 | Initial definition |
| 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 | Only mentioned as reserved word. |
브라우저 호환성
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
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
debugger | Chrome Full support 5 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support 10 | Safari Full support 5 | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 10.1 | Safari iOS Full support 4.2 | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
Legend
- Full support
- Full support
