Easy Tutorial
❮ Prop Style Borderimageslice Prop Style Animationduration ❯

HTML DOM console.table() Method

Console Object

Example

Output a table in the console


Definition and Usage

The console.table() method is used to output table information in the console.

The first parameter is required and the object type needs to be an object or array, corresponding data will be filled into the table.

Note: The console needs to be visible during testing (open the console by pressing F12 in the browser).


Syntax

console.table(tabledata, tablecolumns)

Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
console.table() Yes 12 34 Yes Yes

Parameter Values

Parameter Type Description
tabledata Array or Object Required, the data to be filled into the table.
tablecolumns Array Optional, an array specifying the names of the table header columns.

More Examples

Example

Using an object for the output:

Example

Using an array of objects:

Example

Specifying table header titles, the parameter can only be the corresponding key names:

Console Object

❮ Prop Style Borderimageslice Prop Style Animationduration ❯