DEV Community

Cover image for Console.trace in JavaScript
Jennifer Bland
Jennifer Bland

Posted on • Originally published at


Console.trace in JavaScript

In yesterday's article, I showed you two ways to format your output to the console in JavaScript. If you have not read it, check it out here.

Today I wanted to show you another console command: console.trace().


The console.trace() method outputs a stack trace to the Web console.

Here is an example of how to use this:

function foo() {
  function bar() {

Enter fullscreen mode Exit fullscreen mode

In the console, the following trace will be displayed:

Enter fullscreen mode Exit fullscreen mode

Let's Connect

Thanks for reading my article today. If you like my content, please consider buying me a coffee ☕.

Top comments (0)

Visualizing Promises and Async/Await 🤯

async await

☝️ Check out this all-time classic DEV post