SO I have 2 arrays which are
var num = [\"1\", \"2\", \"3\"];
var cars = [\"Saab\", \"Volvo\", \"BMW\"];
and I made a button where it\'ll add rows and column and pl
This is a simple solution using your approach.
function myFunction() {
var num = ["1", "2", "3"];
var cars = ["Saab", "Volvo", "BMW"];
var table = document.getElementById("myTable");
var rows = new Array(cars.length);
var numCell, carCell;
for (var i = 0; i < cars.length; i++) {
rows[i] = table.insertRow(i);
numCell = rows[i].insertCell(0);
carCell = rows[i].insertCell(1);
numCell.appendChild(document.createTextNode(num[i]));
carCell.appendChild(document.createTextNode(cars[i]));
}
}