JSFiddle - React, Tailwind, and code Playground

by JInks Peng

HTML

<table>
    <thead>Sum Table Column</thead>
    <tr><th>Value one</th><th>Value two</th><th>Value three</th></tr>
  </table>

JavaScript

window.onload = function() {
    var values = new Array(3);
    values[0] = [123.45,'apple',true];
    values[1] = [65,'banana',false];
    values[2] = [1034.99,'cherry',false];
    var mixed = document.querySelector('table');
    var tbody = document.createElement('tbody');
    for(var i = 0; i < values.length; ++i) {
      var tr = document.createElement('tr');
      for(var j = 0; j < values[i].length; ++j) {
        var td = document.createElement('td');
        var txt = document.createTextNode(values[i][j]);
        td.appendChild(txt);
        tr.appendChild(td);
      }
      tbody.appendChild(tr);
    }
      mixed.appendChild(tbody);
  }