title: Scope of global variable inside setInterval
body: <pre><code>function data(){
      var dataval = anyValue;
      var myVar = setInterval(function(){computeData()});
      function computeData(){
        //inside this function there will be computations 
        //where dataval is included
      }
   }
  </code></pre>
  
  <p>This is just an example. My problem is that when I update the value of    dataval and call the data(), the value is not updated inside the setInterval function. Unless I change the value again and call data(). But that is not even working well. </p>
  
  <pre><code>anyValue  = 10
  </code></pre>
  
  <p>//the computation works</p>
  
  <p>//if i update it to decreasingly, anyValue = 9, 
  //it still uses the value 10,</p>
  
  <p>//then if i use anyValue = 8, now it uses the value 9</p>
  
  <p>This is not the code I am using. But same logic. Thanks! I hope you get my question!
  `</p>