Function "remembers" value problem
<p>This is a simplified partial version of my code to demonstrate the issue:</p>

<pre><code>function testFunc(){
    var randomNum = Math.floor( Math.random() * 100 );

  if( !flag ){
      addEvents();
     flag = true;
  };

    function checkNumber(){
       alert(randomNum)
    }

  function addEvents(){
     $("#someElement").click(function(e){ checkNumber() });
  }
}
</code></pre>

<p>I want to bind the click event only ONCE for this element, but use outside variable that changes from someplace else. thing is, this always alerts randomNum with the initial value it 
had when the bind first took place! </p>

<p>why doesn't it "reads" the variable everytime click is triggered?</p>
