How to use Console.Table() Method in JavaScript?

Master on how to use the console.table() method in js or JavaScript to display your data in a neat and organized format. 

This useful tool can help you work more efficiently and improve your debugging skills.

So bear with us as this article delves into the console table in JavaScript.

What is console table in js or JavaScript?

The console.table() in JavaScript presents tabular data in the console as a table.

It requires one compulsory argument, “data,” which can be an array or an object, and an optional parameter called “columns.”

This method outputs the data as a table, with each element in the array (or enumerable property if the data is an object) appearing as a row in the table.

In a nutshell, the table() method allows you to display a table in the console.

What is the syntax of JavaScript console table?

Here’s the syntax for console.table js:

console.table(data,columns); 

or

console.table(data); 


You can fill the table with data, which should be an array or an object.

The “columns” parameter is an array that holds the names of the columns you want to display in the table.

How to use console table in JavaScript?

Here are some examples of using console.table() in JavaScript:

1. Displaying an array of strings

When the data argument is an array, the index column in the table will begin with 0 and increment by one for each row.

console.table(["English", "Math", "Science"]);

Using this code will produce a table with two columns: an index column and a values column.

The values column will show the elements of the array.

Output:

console.table js

2. Displaying an object

When the data argument is an object, the index column in the table represents the keys, while the value column represents the corresponding values for each key.

function Name(firstname, lastname) { 
this.firstname = firstname;
this.lastname = lastname;
}
const name = new Name("It", "Sourcecode");
console.table(name);

Executing this code will result in a table comprising two columns: an index column and a values column.

The index column will display the property names of the object, while the values column will exhibit the corresponding property values.

Output:

js console table

You can also use the following:

var data={ ✅
     name:"caren",
     age:18,
     gender:"female",
}
console.table(data);

Output:

javascript console table

3. Displaying an array of objects

When the data argument is an array of objects, the properties of the objects are listed in each row, with each property appearing in its own column.

function Names(firstname, lastname) { 
this.firstname = firstname;
this.lastname = lastname;
}
const It = new Names("It", "sourcecode");
const Code = new Names("Code", "sourcecode");
const Java = new Names("Java", "sourcecode");
console.table([It, Code, Java]);

When executed, a table will be generated with three columns: an index column and two additional columns for each property of the objects.

The index column will display the indices of the array elements, while the other columns will contain the respective property values.

Output:

You can also use the following command:

function Names(firstname, lastname) {✅
this.firstname = firstname;
this.lastname = lastname;
}
const familymember = {};

familymember.Father = new Names("It", "sourcecode");
familymember.Son = new Names("Code", "sourcecode");
familymember.Daughter = new Names("Java", "sourcecode");

console.table(familymember);

Output:

console.table javascript

4. Displaying nested objects

When the data argument contains nested objects, which means an object whose properties are also objects, the console.table() method correctly labels the index column with the properties of the nested objects.

var Thesismembers = {✅
    Teamleader: {
        firstname: "Anna",
        lastname: "Lisa",
        email: "analisagmail.com"
    },
    Programmer: {
        firstname: "Bailey",
        lastname: "Lake",
        email: "[email protected]"
    },
    DataAnalyst: {
        firstname: "Caleb",
        lastname: "Dawn",
        email: "[email protected]"
    }
}
console.table(Thesismembers);

Output:

javascript console.table

What are the browsers that console table Javascript supports?

The are the following browsers that supports console.table() in js:

  1. Chrome
  2. Edge
  3. Firefox
  4. Safari
  5. Opera

Conclusion

In conclusion, this article discusses how to use the console.table() in js or JavaScript. This method allows you to display data in a table format in the console.

You can use it with arrays or objects as the data input. The method also supports specifying column names for the table.

Examples are provided for displaying arrays of strings, objects, arrays of objects, and nested objects.

It is a useful tool for improving debugging skills and working more efficiently.

We are hoping that this article provides you with enough information that helps you understand console table in JavaScript.

You can also check out the following article:

Thank you for reading itsourcecoders 😊.

Frequently Asked Questions

Is JavaScript still worth learning in 2026?
Yes. JavaScript runs on 98% of websites for the front-end, dominates the back-end via Node.js, powers mobile apps through React Native, builds desktop tools through Electron, and is the scripting layer for most AI tooling (LangChain.js, OpenAI SDK, Vercel AI). Whether you target web, mobile, AI, or full-stack capstones, JavaScript is the broadest single language you can learn.
What is the difference between var, let, and const?
var is function-scoped, hoisted to the top of its scope, and can be redeclared, which leads to bugs in modern code. let is block-scoped (only visible inside the nearest {}) and can be reassigned. const is block-scoped and cannot be reassigned, although object contents can still mutate. Default to const for everything, switch to let only when you actually need to reassign, and avoid var in any code written after 2017.
Which JavaScript version should I target in 2026?
Target ES2020 (ES11) as the safe baseline because every modern browser and Node.js 14+ supports it fully. ES2022 adds useful features like top-level await, private class fields with the # prefix, and the .at() array method. If you are writing for older browsers (IE11 or older Android WebViews), transpile down with Babel or use a build tool like Vite, esbuild, or webpack.
What is the best free editor for JavaScript?
Visual Studio Code is the industry standard, free, with built-in IntelliSense, debugger, terminal, Git, and a huge extension marketplace (ESLint, Prettier, GitHub Copilot, Tailwind). Install the JavaScript and TypeScript Nightly extension for the latest language features. JetBrains WebStorm is more powerful and free for students with a verified .edu email. For quick scratchpad work, the Chrome DevTools Sources panel includes a workspace and breakpoint debugger.
How do I run JavaScript locally vs in the browser?
In the browser: open DevTools with F12 (or right-click then Inspect), go to the Console tab, type or paste your code, press Enter. For HTML pages, add a script tag pointing to your .js file. Locally with Node.js: download Node from nodejs.org (LTS version), then run node script.js in your terminal from the file folder. Use the same Node setup for backend capstones, API integrations, and scripts that do not need a browser.
What can I build with JavaScript for my BSIT capstone?
Common BSIT capstones in JavaScript: full-stack web apps using React or Vue on the front-end with Node.js and Express on the back-end (MongoDB or MySQL for the database), real-time chat or notification systems using Socket.io, single-page dashboards with Chart.js or D3.js, cross-platform mobile apps with React Native, AI-powered chatbots using OpenAI SDK and LangChain.js, and Chrome extensions for productivity tools. Add Tailwind CSS for the UI and Vercel or Netlify for free deployment.
Caren Bautista

Technical Writer at PIES IT Solution

Responsible for crafting clear, well-structured, and beginner-friendly content across the platform. Handles the writing, proofreading, and editorial review of tutorials, guides, and documentation to ensure every article is accurate, readable, and easy to follow.

Expertise: Technical Writing · Content Creation · Documentation · Editorial Writing · JavaScript · TypeScript · Python · Python Errors · HTTP Errors · MS Excel  · View all posts by Caren Bautista →

Leave a Comment