when the program runs, only the last array value image displaying on the screen and other images aren't displaying.
Here is the HTML code
<img id="mg" alt="image not found">
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;
}
}
}