Wednesday, January 8, 2014

Chrome Developer Tools: console.table()

I discovered a nice feature in the Chrome Developer Tools.

Let’s imagine that you got an array of products from an AJAX web service call:

var products = [
    { name: "XBOX", price: "200 $" },
    { name: "Playstation", price: "180 $" },
    { name: "Nintendo", price: "100 $" }
];

If you log this array to the console using console.log() , you don’t get anything useful back:

image

A nicer alternative is the usage of console.table(), which gives you the following result:

image

1 comment:

Gonzalo said...

Good trick! This is quite useful!