console.table()
We are all familiar with things like:
console.log()
console.error()
console.warn()
console.info()
But, console.table()
is a really interesting one.
It basically displays the data that one would log to the console in a table form, as per what the method suggests so.
Example
const items = ["foo", "bar", "baz"];
console.table(items);
Index | Value |
---|---|
0 | foo |
1 | bar |
2 | baz |
console.table()
definitely formats the data nicely and makes things easier to read.