title: div.style.display not working when declared inside a function
body: <p>I'm trying to add an EventListener on  so that when  is clicked it should hide the  &amp; vice versa when clicked so i wanted to use classList.toggle to toggle by adding &amp; removing function named "hidden"</p>
  
  <pre><code>var p1 = document.getElementById("p1")
  var h2 = document.querySelectorAll("h2")[0]
  h2.addEventListener("click",function(){
  p1.classList.add("hidden")
  })
  
  function hidden(div){
  div.style.display="none";
  }
  </code></pre>