title: How to pass variable value from one function to another in Nightwatch js
body: <p>I am using Nightwatch.js test automation framework. </p>
  
  <p>In my code I get the value, but I am not being able to pass this recorded value to another function. Here is the code:</p>
  
  <pre><code>CreateLife: function (browser) {
  
      browser.getValue('#LifeID', function (r) {
          a = r.value;
  
          browser.execute(function () {
              LifeTemplatesManager.loadAddOnlineItem(a);  //doesn't work/The value of 'a' is not being passed.
          });
          console.log("ID of newly created Life", a);
      }
  }
  </code></pre>
  
  <p>Whenever a new life gets created, it gets assigned a new ID. 
  I am able to get this ID and store it in 'a' and display it in the console.
  My question is how can I pass the value of 'a' into the function 'LifeTemplatesManager.loadAddOnlineItem'</p>
  
  <p>Help would be appreciated. I am a beginner at JS. </p>
  
  <p>Thanks. </p>