title: Can't change variable in if/else
body: <p>I can't find a reason why the following code is not working:</p>
  
  <pre><code>var nav = document.getElementById("nav").style.visibility;
  if (nav === "" || nav === "hidden")
      nav = "visible";
  else
      nav = "hidden";
  </code></pre>
  
  <p>Can someone explain me why I cannot change <code>nav</code> in the if..else?</p>