console.trace()
Outputs a stack trace from the point where it is called.
Syntax
console.trace(...data)
Returns
undefined — Returns `undefined`.
Examples
function inner() {
console.trace("here");
}
function outer() {
inner();
}
outer();
Output
Trace: here
at inner
at outer
at <anonymous>
Notes
- Helpful for discovering how a function was reached without throwing.
- The exact frame format varies by engine.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 6 |
| safari | 4 |
| edge | 12 |
| node | 0.10 |