Arrays

Provide arrays in your dataset.

Instead of objects you can also provide arrays in your dataset. In this case the indicies are used as column names.

import { Table } from 'voici.js'

const data = [
  ['Homer', 'Simpson', 39],
  ['Marge', 'Simpson', 36],
  ['Bart', 'Simpson', 10],
  ['Lisa', 'Simpson', 8],
  ['Maggie', 'Simpson', 1]
];

const table = new Table(data);
table.printPlain();

Output:

  0         1          2   
===========================
  Homer     Simpson    39  
  Marge     Simpson    36  
  Bart      Simpson    10  
  Lisa      Simpson    8   
  Maggie    Simpson    1   

Last updated