title: JavaScript to set value of variable inside it, and then after retrive variable's data on another call
body: <p>I want a function in JS, which can take some value at first call and set it to a variable inside it.
  And then again on another call i want to again get the data of that variable.</p>
  
  <p>something like this: 
  <strong>while calling the function for first time</strong></p>
  
  <pre><code>function set_and_get(value){
      var a = value;
  }
  </code></pre>
  
  <p><strong>on another call it should return the value like</strong></p>
  
  <pre><code>returned_value = set_and_get()
  </code></pre>
  
  <p>Thanks.</p>