How to tabulate array key values using console.table

console.table is a function for tabulating arrays key value pairs it retuns a table when given an array as input.

const table = Array(5).fill(0)
console.table(table)



┌─────────┬────────┐
│ (index) │ Values │
├─────────┼────────┤
│    0    │   0    │
│    1    │   0    │
│    2    │   0    │
│    3    │   0    │
│    4    │   0    │
└─────────┴────────┘

Comments

Popular posts from this blog

How to make a static http server in nodejs using express

What is 'this.' keyword in JavaScript

Ways of iterating Object properties in JavaScript

Array concat method in JavaScript

How to create promises in JavaScript