Console trace()

Example

Show how the code ended up here:

function myFunction() {
  myOtherFunction();
}

function myOtherFunction() {
  console.trace();
}
Try it Yourself »

Description

The trace() method displays a trace that show how the code ended up at a certain point.

Note

When testing console methods, be sure to have the console view visible.

Press F12 to open the console veiw.


Syntax

console.trace(label)

Parameters

Parameter Description
label Optional.
A label to give the timer a name.

Browser Support

console.trace() is supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.