I learned a handful of console tricks from this article.

console.group()

When logging to the console, you can use console.group() to name a group and collect console ouptput. Calling console.groupEnd() will end the named group. You can even create nested named groups.

The following code will organize the console output under a group named “Starting up”. Nested under that group will be “First task” and “Second task” groups. These groups can also be auto-collapsed if you don’t want them cluttering up your console output.

console.group('Starting up');
console.group('First task');
console.log('First task starting');
console.log('First task complete');
console.groupEnd('First task');
console.group('Second task');
console.log('Second task starting');
console.log('Second task complete');
console.groupEnd('Second task');
console.groupEnd('Starting up');

console.group() output

console.assert()

The console.assert() function will print an error string to the console if the assertion used as the first parameter is false:

console.assert(article.tagCount > 0, "There are no tags for this article.");

Check out the full article for more tips.