title: How to access variable dynamically inside an anonymous function/closure?
body: <p>To keep the global namespace clean, my JavaScript code is wrapped like this:</p>
  
  <pre><code>(function() {
      /* my code */
  })();
  </code></pre>
  
  <p>Now I have some variables declared in this scope which I want to access using a variable variable name (e.g. the name is <code>'something' + someVar</code>).
  In the global scope I'd simply use <code>window['varname']</code>, but obviously that doesn't work.</p>
  
  <p>Is there a good way to do what I want? If not I could simply put those variables inside an object to use the array notation...</p>
  
  <p>Note: <code>eval('varname')</code> is not an acceptable solution. So please don't suggest that.</p>