title: If a variable is created within the scope of a function that returns a function that uses that variable. Is it possible to acces that variable outside
body: <pre><code>function creatPrintNumFunction()
  {
    var num= 12;
    return function printNum()
    {
       console.log(num);
    }
  }
  
   var printer = creatPrintNumFunction();
  printer.num =13; //this part doesn't work but is there a way to access this Num variable Outside the creatPrintNumFunction, The printer function must be finding the num variable from somewhere.
  printer();
  
  </code></pre>
  <p>So how can I get this code to print 13 instead of 12 <strong>most importantly with out changing any of the code of the createPrintNumFunction().</strong></p>
  <p>For more context on what I really need to use this theory for. I'm using an external module express-sessions in node.js that I don't want to change. There is this 'store' variable where all the sessions are stored that I need to access only problem is that it's created within a function.There is another way i could access it but it's not really convenient</p>