title: How to eval variables into local scope object's properties instead of global scope in JavaScript
body: <p>I have some code return from server like "var myVar = 314;", I would like to create a context object like so var context = {}; and then eval the script "var myVar = 314;" into properties of context, how could I achieve this ?</p>
  
  <p>I have tried the below code, but without success:</p>
  
  <pre><code>var context = {};
  eval.call(context, "var myVar = 314;");
  </code></pre>
  
  <p><strong>EDIT</strong>
  May be I wasn't clear enough in the first place, the result I expected is: after eval(), I got the properties in the context object, the aim is to avoid global scope population.</p>
  
  <p>For example,</p>
  
  <pre><code>var context = {};
  eval.call(context, "var myVar = 314;");
  </code></pre>
  
  <p>I would expect the result as context.myVar = 314.</p>