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