Including a stack trace when logging console.trace() method of JavaScript
function foo()
{
console.trace('Programming Logic and Code');
}
foo();
Will display this in the console:
Programming Logic and Code VM696:1 foo
@ VM696:1 (anonymous function)
@ (program):1
Note: Where available it's also useful to know that the same stack trace is accessible as a property of the Error object. This can be useful for post-processing and gathering automated feedback.
var e = new Error('foo'); console.log(e.stack);
JavaScript Printing to browser Console for debugging
JavaScript Formatting Console Output
function foo()
{
console.trace('Programming Logic and Code');
}
foo();
Will display this in the console:
Programming Logic and Code VM696:1 foo
@ VM696:1 (anonymous function)
@ (program):1
Note: Where available it's also useful to know that the same stack trace is accessible as a property of the Error object. This can be useful for post-processing and gathering automated feedback.
var e = new Error('foo'); console.log(e.stack);
JavaScript Printing to browser Console for debugging
JavaScript Formatting Console Output
No comments:
Post a Comment