DEV Community

Discussion on: 2 Quick Tips when working with JS console output

Collapse
 
myogeshchavan97 profile image
Yogesh Chavan • Edited

For console.table, Instead of displaying all the fields, you can even pass the fields to be displayed as an array like this:

console.table([
    { firstName: 'John', lastName: 'Doe', age: 2 },
    { firstName: 'William', lastName: 'Shakespeare', age: 3 },
], ['firstName', 'lastName']);

So it will just display firstName and lastName. It's very handy when there are a lot of fields and we want only some of the fields

Collapse
 
tawn33y profile image
Tony

This is quite handy. Thanks for the tip!