Kenny Shaw Kenny Shaw - 2 months ago 5x
Javascript Question

Use with javascript

So I have a few javascript arrays, ex.

array1 = [1,2,3]
array2 = [4,5,6]
and I want these arrays to represent the column data, not row data like it wants.
How would I make the table to look like:


I've been pulling my hair out all day, and I can't seem to find a this even supported?


Simply output the data how you need it.

var rows = '';

for (var i = 0; i < array.length; i++) { //assumes equal size arrays
  rows += '<tr><td>'+array[i]+'</td><td>'+array2[i]+'</td></tr>';
  //or however you do this