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

What is 'this.' keyword in JavaScript

How to make a static http server in nodejs using express

How to get user's ip address in JavaScript

How to create promises in JavaScript

How to evaluate a string on a regular expression rule in JavaScript