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 html5 breakout game in JavaScript

How to set content disposition headers for express nodejs apps

Ways of iterating Object properties in JavaScript

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