From FirebugWiki
Revision as of 16:13, 21 November 2013 by Sebastianz (Talk | contribs) (Added categories)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Allows to log provided data using tabular layout. The method takes one required parameter that represents table-like data (array of arrays or list of objects). The optional columns parameter can be used to specify columns and/or properties to be logged.


console.table(data[, columns])



Data to log.

This is either an object or an array. (required)


Array containing the names for the columns in the output table. (optional)


console.table([1, 2, 3])

This creates a table containing three rows. The first one will contain 1, the second 2 and the third 3. Because there was no column title defined, the column will be named Object Properties

>ou will get the same output via table({a: 1, b: 2, c: 3}).

console.table([[1, 2], [3, 4]])

This creates a table containing two rows with two columns. The first row will contain 1 and 2 and the second one 3 and 4. The columns will be named by their index, i.e. 0 and 1.

You will get the same output via console.table({a: [1, 2], b: [3, 4]}).

function Person(firstName, lastName, age)
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;

var family = {};
family.mother = new Person("Susan", "Doyle", 32);
family.father = new Person("John", "Doyle", 33);
family.daughter = new Person("Lily", "Doyle", 5);
family.son = new Person("Mike", "Doyle", 8);


This creates a table containing four rows with three columns. The columns contain the first name, the last name and the age of each person:


For more examples see the article at

See also[edit]