title: how to access/get the variable in one javascript file to another javascript file
body: <p>How to access/get the variable from one javascript file to another javascript file.
  like first.js contains a function first.js like below.</p>
  
  <pre><code>this.first = function(){
      var x = ['new','old'] 
  }
  </code></pre>
  
  <p>now, I want to access the 'x' in another file say second.js
  I have tried </p>
  
  <pre><code>var first = require('../first.js');  //path to the first.js file
  console.log(first.x)
  </code></pre>
  
  <p>but getting the undefined value. 
  i want to get/access the 'x' from first.js
  I am using this for protractor E2E testing using page objects.</p>