title: Javascript IF-Else not working as expected
body: <p>HI guys trying to learn javascript and been on w3schools...came across a try me that flipped the image right away from smiley.gif to landscape.jpg...so I decided I was going to see if I learned anything by flipping it with a button instead worked great...but then I decided that on each click I was going to make it go back and forth from smiley.gif to landscape and back to smiley etc...
  well thats when the frustration set in..I tried a million ways other then what I originally started with down in the code section...can someone explain to me why this doesnt work..I get no console errors...It still does the initial flip from smiley to landscape on first click but then never changes back to smiley on the second click.  Thanks in Advance  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;img id="image" src="smiley.gif" width="160" height="120"&gt;&lt;br&gt;
  &lt;button onclick= myFunc() &gt;Click&lt;/button&gt;;
  
  &lt;script&gt;
    function myFunc() {
  
      if (document.getElementById("image").src == "smiley.gif") {
  
        return document.getElementById("image").src = "landscape.jpg"
  
      } else {
  
        return document.getElementById("image").src = "smiley.gif"
  
      }
    };
  &lt;/script&gt;
  
  &lt;p&gt;The original image was smiley.gif, but the script changed it to landscape.jpg&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>