Logging Table Data in Javascript | Task

Ole Ersoy
Jan - 05  -  1 min

Scenario

We have an array of customer objects and we want to log them in a table format.

Approach

Use console.table.

const customers = [
  { id: 1, name: 'Cookie Monster' },
  { id: 2, name: 'Swedish Chef' },
];
console.table(customers);

Demo