DEV Community

Discussion on: Stop using default console.log, check this instead

Collapse
guilhermetoti profile image
Guilherme Toti Author

Thanks!
True! I completely forgot about console.trace(), thanks for remind me!

Collapse
salyadav profile image
Saloni Yadav

What does trace do?

Thread Thread
guilhermetoti profile image
Guilherme Toti Author

Trace will show the stack trace, where that fails.
Let’s say in your app you have like a function that calls another function, that calls another function.
If you add a trace in the last function and something happen, it will log exactly where happened, like:

function_3 at line 1 (example)
function_2 at line 5 (example)
function_1 at line 88 (example)