This page was translated from English by the community. Learn more and join the MDN Web Docs community.
console.trace()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
console.trace() 메서드는 웹 콘솔에 스택 추적을 출력합니다.
참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.
구문
js
console.trace([...any, ...data]);
매개변수
...any, ...dataOptional-
스택 추적과 함께 콘솔에 출력할 0개 이상의 객체.
console.log()메서드에 전달되는 것과 동일한 방식으로 조합되고 형식이 지정됩니다.
예제
js
function foo() {
function bar() {
console.trace();
}
bar();
}
foo();
콘솔에 다음과 같은 추적이 표시됩니다.
bar foo <anonymous>
명세
| Specification |
|---|
| Console> # trace> |
브라우저 호환성
Enable JavaScript to view this browser compatibility table.