title: Changing global variable value inside function
body: <p>Here is my simple scenario. I have a variable defined inside the <code>ready()</code> function which assigns the first value.</p>
  
  <p>I also have a function outside <code>ready()</code>. What I want to do is to use the changed variable inside my new function.</p>
  
  <p>Here is my JavaScript code:</p>
  
  <pre><code>var myFunction = function() {
      // I wanna change Vp value here and wanna 
      // use this function with the new value        
      Vp = "new value";
  
      myFunction2 (); 
  };
  
  $(document).ready(function () {
  
      var Vp = "first value asign";
      $('#btnAddCustomer').click(myFunction);
  
      var myFunction2 = function() {
          // I will use Vp variable here with new value
      };
  });
  </code></pre>