title: Else condition is not working in javascript
body: <p>I'm a beginner to JavaScript. Can someone help me in this regard?</p>
  
  <p>In the below code the logic for submit button doesn't work. <code>_btn.addEventListener</code>. Only the if part is getting executed, some issue with the else part condition. If  the "if" condition gets satisfied then the alert is getting executed and not the conditions in else part even if the date and image is clicked.</p>
  
  <pre><code> &lt;p align=center&gt;
          &lt;input type="submit" value="submit" id="button"&gt;
      &lt;/p&gt;
  
  
   &lt;script type="text/javascript"&gt;
  let _img = document.getElementById("img");
  let _img1 = document.getElementById("img1");
  let _img2 = document.getElementById("img2");
  let _picker = document.getElementById("picker");
  let _btn = document.getElementById("button");
  
  let isImgClicked = false;
  let isDatePicked = false;
  /*let ImgClicked = '_img';
  let ImgClicked1 = '_img1';
  let ImgClicked2 = '_img2';
  let DatePicked = '2019';
  let DatePicked1 = '2020';*/
  
  _img.addEventListener("click", function(){
    isImgClicked = true;
    ImgClicked=true
  });
  /*_img1.addEventListener("click", function(){
    ImgClicked1 = true;
  });
  _img2.addEventListener("click", function(){
    ImgClicked2 = true;
  }); */
  _picker.addEventListener("click", function(){
    isDatePicked = true;
  });
  _btn.addEventListener("click", function(){
  
                if(!isImgClicked || !isDatePicked)
                {
                    alert("select the Year and Click the car image");
  
                }
                else 
                   {
                    if((isImgClicked == "_img") &amp;&amp; (isDatePicked == "DatePicked"))
                        {
                        window.location.replace("sample1.html");
                        }
                    else if((isImgClicked == "_img") &amp;&amp; (isDatePicked == "DatePicked1"))
                        {
                        window.location.replace("sample2.html");
                        }
                    else
                    {
                          if((isImgClicked == "_img1") &amp;&amp; (isDatePicked == "DatePicked"))
                    {
                    window.location.replace("sample3.html");
                    }
                else if((isImgClicked == "_img1") &amp;&amp; (isDatePicked == "DatePicked1"))
                    {
                     window.location.replace("sample4.html");
                    }
                else
                        {
                        alert("!!!!");
                        }
                   }
                   }
  
          });
  &lt;/script&gt;
  </code></pre>