Console

console.table

Displays tabular data as a table in the console

Syntax

JavaScript
console.table(tabularData, properties?)

Parameters

ParameterTypeDescription
tabularDataanyThe data to display as a table
propertiesstring[]An array of property names to include

Return Value

undefined

Examples

Basic Usage
const users = [
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 },
];
console.table(users);
Practical Example
const data = { a: 1, b: 2, c: 3 };
console.table(data);
Advanced Usage
const people = [
  { name: 'Alice', age: 30, city: 'NYC' },
  { name: 'Bob', age: 25, city: 'LA' },
];
console.table(people, ['name', 'city']);

Understanding console.table

The console.table method in JavaScript displays tabular data as a table in the console. It belongs to the console object and is one of the most widely used methods for working with console values in modern JavaScript and TypeScript applications.

The method signature is console.table(tabularData, properties?). It accepts 2 parameters: tabularData, properties. When called, it returns undefined. Understanding when and how to use table() helps you write more expressive, readable code.

Common use cases for console.table include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like console-log, console-group, enabling you to chain operations together for complex data manipulation pipelines.

Browser support for console.table is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.

Browser Compatibility

Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.

Related Methods

More Console Methods

Other methods in the Console object

Related Tools

More Console Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.