I have two sets of data stored in arrays. This is how my information is organized:
var apples = [ "red", "green", "yellow"];
var oranges = [ "sweet", "sour"]
The goal is to create tables with the same number of rows as there are elements in the apple array and the same number of columns as there are elements in the oranges array. This is what has been accomplished thus far:
<html>
<table id = "myfruit">
<tr>
<td> Fruits</td>
</tr>
</table>
<body>
<script>
var apples = [ "red", "green", "yellow"];
var oranges = [ "sweet", "sour"]
var numberOfRows = apples.length;
var numberOfColumns = oranges.length;
for (var i = 0; i < numberOfRows; i++){
var column = "<td>" + apples[i] + "</td>";
for (var j = 0; j < numberOfColumns; j++){
column += "<td id =" apples.concat(oranges) "></td>;
}
$("#myfruit").append("<tr>" + column + "</tr>");
}
</script>
</body>
</html>
However, I am still encountering difficulties in displaying the data accurately.