Reputation: 59
I know one of the most basic debugging tools in JavaScript is console.log()
. The console comes with several other useful methods that can add to a developer’s debugging toolkit.
but
I'm pretty confused about console.table()
method. Is anyone explain?
Upvotes: 0
Views: 354
Reputation: 4453
The Console Object: The console object gives you access to the browser’s console. It lets you output strings, arrays, and objects that help debug your code. The console is part of the window object, and is supplied by the Browser Object Model (BOM).
There are four different ways of outputting a message to the console:
while there is another method that is:
console.table()
let me explain The table method displays an array or object as a table.
console.table(['Javascript', 'PHP', 'Perl', 'C++']);
example:
const superhero = {
firstname: 'Peter',
lastname: 'Parker',
}
console.table(superhero);
Upvotes: 1