debugger
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. |
브라우저 호환성
BCD tables only load in the browser