The console.trace() static method outputs a stack trace to the console.
console.trace()
MDN Reference