Preview:
//HTML
 <img name="slide" />
    

//Javascript
let i = 0; // Start Point
let images = []; // Images Array
let time = 3000; // Time Between Switch

// Change Image
function changeImg() {
  // Image List
  images[i] = `img-${i}.jpg`;
  images.length = 4;

  document.slide.src = images[i];
  // Check If Index Is Under Max
  if (i < images.length - 1) {
    // Add 1 to Index
    i++;
  } else {
    // Reset Back To O
    i = 0;
  }

  // Run function every x seconds
  setTimeout('changeImg()', time);
}

// Run function when page loads
window.onload = changeImg;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter