title: How to call a function saved as a variable javascript
body: <p>I have the following code: </p>
  
  <pre><code>function myFunction(){
    var bob = function() {
  alert("works");
      } 
    };
  //document.getElementById("btn").addEventListener('click', bob); //calls the function 
  }
  </code></pre>
  
  <p>How do I call the <code>bob function</code> outside the <code>myFunction()</code> ? It works with the btn element, but I want it to be called outside </p>
  
  <p>Thanks ! </p>