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 July 2015.

console.trace() 메서드는 웹 콘솔에 스택 추적을 출력합니다.

참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.

자세한 내용과 예제는 console 문서의 스택 추적을 참고하세요.

구문

js
console.trace([...any, ...data]);

매개변수

...any, ...data Optional

스택 추적과 함께 콘솔에 출력할 0개 이상의 객체. console.log() 메서드에 전달되는 것과 동일한 방식으로 조합되고 형식이 지정됩니다.

예제

js
function foo() {
  function bar() {
    console.trace();
  }
  bar();
}

foo();

콘솔에 다음과 같은 추적이 표시됩니다.

bar
foo
<anonymous>

명세

Specification
Console
# trace

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
trace() static method

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support