I've been attempting to generate a JavaScript table with rows of 10 using an array of images, but unfortunately, I have not been successful. The issue is that while the table itself appears to be functioning correctly, each cell only displays [object HTMLImageElement] instead of the actual image.
Below is the code that I have attempted:
for(var i=0; i<myArray.length; i++){
myArray[i] = new Image();
myArray[i].src = i + '.gif';
}
document.writeln('<table border = 1 >');
for(var j=0; j<myArray.length; j++){
if(j%10==0 && j!==0){
document.writeln('</tr><tr>');
}
document.writeln('<td >' + myArray[j] + '</td>');
}
document.writeln('</tr></table>');