console.trace mdn code example
Example 1: javascript dump strack trace
console.trace();
Example 2: javascript get stack trace
try {
throw "Could not parse that text!";
} catch(e) {
console.log(e.stack); //log the stack trace to console
}