title: Javascript eval ReferenceError: is not defined
body: <p>I need to dynamical create a variable off the value of a variable from an argument I am pulling in from a script. But I first want to check if it already exists so I don't overwrite it, if it is already set. </p>
  
  <p>I am leveraging eval to expand the value of the variable and tag it onto a variable suffix but no matter what I use to check for the undefined I am getting a reference error on the check.</p>
  
  <p>Below is the simple code snippet</p>
  
  <pre><code>chkUser = args[1];
  
  if(typeof eval(chkUser+"lastseen")==="undefined") ;
  </code></pre>
  
  <p>I've also tried put the eval in parens and putting undefined in ' ' and pulled them completely and switching typeof to the JavaScript standard undefined as such </p>
  
  <pre><code>if( eval(chkUser+"lastseen")=== undefined) ;
  </code></pre>
  
  <p>but I always get ReferenceError: robertlastseen is not defined or what ever chkUser expands out to. </p>