Javascript console.table() Method

Introduction

Write a table in the console:

console.table(["HTML", "Javascript", "CSS"]);

Press F12 on your keyboard to view the table in the console view.

You can sort the table by clicking the column names.

View in separate window

<!DOCTYPE html>
<html>
<body>
<script>
console.table(["HTML", "Javascript", "CSS"]);
</script>// ww w .  j  av  a 2 s . c  om
</body>
</html>

The console.table() method writes a table in the console view.

The first parameter is required, and must be either an object, or an array, containing data to fill the table.

When testing console methods, be sure to have the console view visible (press F12 to view the console).

console.table(tabledata, tablecolumns);

Parameter Values

ParameterTypeDescription
tabledataObject or Array Required. The table data
tablecolumns Array Optional. Table column names



PreviousNext

Related