I find myself sometimes using the console.trace()
to check from where a method was called. That is when I am too lazy to set breakpoints in the Javascript debugger.
By using console.trace()
, we have the get to display the stack trace of every function call leading up to the trace statement. This stack trace is then outputted to the console for examination.
It's great for debugging when we have mutiple posbile paths that can lead to a given function call.
I think it can be useful and made this short video about it.
Enjoy, and please write to me at
[email protected] if you want a video about a specific JS or CSS subject.