DEV Community

Cover image for Simple function to print table in browser console

Posted on • Updated on

Simple function to print table in browser console

TLDR - console.table()

When debugging for performance bottlenecks often we want to run through loops and function calls and record the time between the calls and see the bottle necks so we can optimise them.

I have found console.table() to be very helpful.


let tfun1s,tfun2e,tfun2s,tfun2e,ts,te = 0;

ts =;
tfun1s =;
tfun1e =;

tfun2s =;
tfun2e =;
te =;

// time in microseconds
Enter fullscreen mode Exit fullscreen mode

On the console the output shows up like this

Image description

I found this much later and its so much easier to use and control with wrapper functions instead of numerous console logs dotted along the code.

Happy debugging!

Would like to know any other helpful tips for debugging client side code for optimisation - please leave you comments.

Cover photo credits -

Top comments (0)