title: End of function return to before function
body: <p>sorry about this might be weird question with weird title.
  i have this function in Javascript:</p>
  
  <pre><code>function alfred(){
      document.querySelector('.image-7-panel').classList.toggle('notactive');
      document.querySelector('.image-8-panel').classList.toggle('notactive');
      document.querySelector('.background').classList.toggle('alfred-background');
      var text = document.getElementById("heroes");
      if(text.innerHTML !== "Alfred"){
          text.innerHTML = "Alfred";
      } else {
          text.innerHTML = "Heroes are back";
      }
  }
  </code></pre>
  
  <p>but I want that after this is running, it goes back to where it was before running. how can I put this running? This function runs on click and with the same click another one runs. The clearTimeout is not helping me here but can't find a normal solution for this.
   Going to explain with the real example. When I click, shows an image and a name associated. I want that after I click, the image goes back to the one it was before clicking and also the nam</p>