***Trying to get my table to show up in my html document thetable is written in js but it is not showing up. This is a tablewith 5 rows and 3 columns with images.
JavaScript
//Array
var foodImage2 = [‘<img src=”images/image6.jpg”‘, ‘<imgsrc=”images/image7.jpg”‘, ‘<img src=”images/image8.jpg”‘,'<img src=”images/image9.jpg”‘, ‘<imgsrc=”images/image10.jpg”‘];
var item2 = [‘Veggie Soup’, ‘Chicken Salad’, ‘Veggie Mac NCheese’, ‘Grilled Chicken Salad’, ‘Sea Food Deluxe’];
var price2 = [ 12.99, 8.95, 9.99, 14.99, 24.99];
var text2 = document.getElementById(‘table2’);
var table2 ='<table><thead><tr><th>Image</th><th>ItemName</th><th>Price</th></tr></thead></tbody>’;
for(var x = 0; x < foodImage2.length; x++){
table2 += ‘<tr><td>’ + foodImage2[x] +'</td><td>’ + item2[x] + ‘</td><td>’ +price2[x] + ‘</td></tr>’;
}
table2 += ‘</tbody></table>’;
//Displays data in html
text2.innerHTML = table2;
HTML
<table width=”100%” border=”5″id=”table2″></table>
Expert Answer
Answer to ***Trying to get my table to show up in my html document the table is written in js but it is not showing up. This is a …