The console.table() method in JavaScript

Ah, debugging… Something we all have to do! You’re undoubtedly familiar with the console.log() method. But did you know you can get much prettier output using the console.table() method?

Object literals

Given the following object literal:

var person = {
  name: "Kieran",
  nationality: "British",
  occupation: "Web Developer"

I can call console.table(person) to get the following output:

(index) Values
name Kieran
nationality British
occupation Web Developer

Array literals

It also works with array literals:

var fruits = [

Calling console.table(fruits) gives me the following output:

(index) Values
0 Apples
1 Bananas
2 Clementines


The console.table() method prints things to the console in a pretty, readable format. It’s a nice alternative to the console.log() method.

For more information, check out console.table() in the MDN Web Docs.

If you have questions, feedback, or any other suggestions, please do email me. I'd love to hear from you!