2022-12-25

 25 Dec 2022

Console.table()

The log() method of the Console object is commonly used to display output and it works great. When working with objects or arrays that give rise to larger data, such as:

const data = [
  {
    id: 1,
    name: 'John Doe',
    age: 30}
  ,{
    id: 2,
    name: 'Jane Doe',
    age: 40
  },
  {
    id: 3,
    name: 'Mary Doe',
    age: 50
  }
]

Running console.log(data) will output the following to the terminal:

Drilling through individual values can be tiresome, so an even easier way to display the data is by using console.table(data), which will tabulate the output instead:

As the data grows in complexity, this is a great method that can display an object or an array of objects that hold similar keys.

#TIL #TheMoreYouKnow

Webmentions & Comments

Copyright © Paramdeo Singh · Built with Jekyll in 🇬🇾 · All Rights Reserved

this node is permanently morphing last updated on 26 Dec 2022

Paramdeo Singh Guyana

Generalist. Edgerunner. Riding the wave of consciousness in this treacherous mortal sea.

Technology Design Strategy Literature Personal Blogs
Search Site

Results are from Blog, Link Dumps, and #TIL