title: auto toggle between divs. settimeout not working
body: <p>i have created a div with three slides that user can toggle between them
  but the problem is i'm trying to make it as a auto slide but the settimeout it's not working.the toggle button works fine i can switch between slides without a problem.
  here is the code</p>
  
  <pre><code>var slideIndex = 1;
  showSlides(slideIndex);
  
  function plusSlides(n) {
    showSlides(slideIndex += n);
  }
  function showSlides(n) {
    var i;
    var slide = document.getElementsByClassName("slide");
    if (n &gt; slide.length) {slideIndex = 1}    
    if (n &lt; 1) {slideIndex = slide.length}
    for (i = 0; i &lt; slide.length; i++) {
        slide[i].style.display = "none";  
    }
    slide[slideIndex-1].style.display = "block"; 
    setTimeout(showSlides, 2000);
  }
  </code></pre>
  
  <p>and the stylesheet :</p>
  
  <pre><code>html , body {
    padding: 0;
    margin: 0;
    box-sizing: border-box ;
    text-align: center ;
  }
  /* Top */
  .top {
  overflow: hidden;
  }
  /* Navbar */
  .navbar {
    display: flex ;
    flex-direction: row-reverse;
    background: transparent ;   
    align-items: center ;
    justify-content: space-between ;
    z-index: 9999;
    position : absolute ;
    width: 100%;
  }
  .navbar a {
    text-decoration: none ;
    color : #fff ;
    font-size: 17px;
    flex-shrink: 1 ;
    margin-top: 10px;
    margin-left: 20px;
    margin-right: 40px;
    padding: 10px;
  }
  .navbar a:nth-last-child(3) {
    margin-left: auto ;
  }
  /* slideshow */
  .slideshow {
    width: 100%;
    position: relative;
  }
  .slide {
    padding: 100px;
    color : #fff;
  }
  #slide1 {
    background: url(bm2.jpg) no-repeat center center ;
    background-size: cover ;
    height: 457px;
  }
  #slide2 {
    background: url(bm3.jpg) no-repeat center center ;
    background-size: cover ;
    height: 457px;
  }
  #slide3 {
    background: url(bm1.jpg) no-repeat center center ;
    background-size: cover ;
    height: 457px;
  }
  .prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
  }
  .next {
    right: 0;
    border-radius: 3px 0 0 3px;
  }
  .prev {
    left : 0;
    border-radius: 3px 0 0 3px;
  }
  </code></pre>
  
  <p>i'll be glad to know what's wrong with my code or what i'm doing wrong here</p>
  
  <p>thanks for your time.</p>