More than console.log

We often use console.log as a powerful tool for debugging. But beside that simple log, we still have many other options which are useful and good time-savers. Inspired by https://egghead.io/series/js-console-for-power-users, I write this article as an quick overview of that series and what I believe are most useful.

Make things semantic

console.log('Log style');
console.info('Info style');
console.warn('Warn style');
console.error('Error style');

Grouping

console.group(‘Group title’);
console.log(‘Item inside group’);
console.groupEnd();

Quick boolean check

console.assert(expression, 'Error message if experssion fail'); 

Log the timing of process

console.time('Timer');
...do something...
console.timeEnd('Timer');

Pretty array of objects

console.table([object1, object2, object3]);
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.