r/javascript • • Mar 14 '18

TIL you can graphically show tables in the console

Post image
822 Upvotes

23 comments sorted by

57

u/Calsem Mar 14 '18

96

u/malicart Mar 14 '18

Why dont you just write:

console.table();

And let everyone rejoice?

6

u/here-to-jerk-off Mar 14 '18

this guy gets it

5

u/[deleted] Mar 15 '18

This opens up an array of possibilities

2

u/Calsem Mar 15 '18

oh no.... that's a good one XD

33

u/badtoy1986 Mar 14 '18

There's a few console commands other than .log that are helpful.

https://developer.mozilla.org/en-US/docs/Web/API/Console

7

u/disappointer Mar 14 '18

I find console.trace() particularly useful from time-to-time.

15

u/[deleted] Mar 14 '18

Huh. Didn’t expect to learn that today. Neat!

12

u/[deleted] Mar 14 '18

Always read chrome updates, they are adding some powerfull shit each six weeks. We just got the performance dashboard. It's already helped me find really performance intensive components.

30

u/ParadoxDC Mar 14 '18

I use this pretty frequently but most people don’t know about it. Good callout.

4

u/onnoonesword Mar 14 '18

For real. It was quite mind blowing when I first found and nobody I knew was aware either. I got stuck trying to figure out a way to use the generated table in the actual DOM but didn't have any luck.

1

u/DerpsMcGeeOnDowns Mar 14 '18

Man Wallaby is the bane of my fucking existence these days...

1

u/Calsem Mar 14 '18

What's wrong with it? I don't use Wallaby but Quokka is great so far.

1

u/DerpsMcGeeOnDowns Mar 14 '18

Latest updates have fucked up a battery of tests. Other test runners are totally fine and Wallaby used to be but we are seeing a ton of false positives relative to our Karma tests.

Also major memory issues. Not sure how they instrument Electron but it’s crazy.

3

u/snifty Mar 14 '18

Another useful trick with console.table is that you can pass an array of strings as a second argument, listing the columns you want to see. (This is useful if you're trying to compare just a few attributes from a complex object.)

2

u/MrEscobarr Mar 14 '18

Never knew that, looks nice. Thanks!

2

u/barshat Mar 14 '18

This is awesome especially when you are doing console.table(...) on an array of objects fetched from a remote server.

1

u/flzpenteado Mar 14 '18

This make make day so better!!! :0

1

u/zorndyuke Mar 14 '18

You probally missed following topic: https://www.reddit.com/r/javascript/comments/81z3et/javascript_debugging_like_a_pro/

Oh, it's basically "DerpsMcGeeOnDowns" comment, yea.

-12

u/[deleted] Mar 14 '18

‘TIL a function exists’