One issue with the program is that when it runs, only the last array value image is displaying on the screen while the other images are not.
Below is the HTML code:
<img id="mg" alt="image not found">
And here is the JavaScript code:
var images=["image", "image2","img","imag"]
test();
function test(){
var index = 0;
for(var count=0; count<images.length; count++){
document.getElementById('mg').src = images[count] + ".jpg";
document.getElementById("mg").width = "500";
document.getElementById("mg").height = "300";
index = index + 1;
setTimeout(test, 1000);
if(index + 1 > images.length){
index = 0;
count = 0;
}
}
}