title: How to call a function using a dynamic name in JS
body: <p>I'm trying to call this a function following the same example that I've posted bellow. So the problem is that the method that I'm using to call the function doesn't work... I need something like that cuz I'm going to call those functions through listening events. Some one knows the right away to do it? </p>
  
  <p>Thx.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//variables
  var ta = 3213;
  var da = 44;
  var s = [];
  
  //Create string representation of function
  s[1] = "function test0(){  alert(" + da + "); }";
  s[0] = "function test1(){  alert(" + ta +"); }";
  
  //"Register" the function
  for(i=0; i&lt; s.length; i++){
   eval(s[i]);
  }
  
  // calling the function
  this["test"+1];</code></pre>
  </div>
  </div>
  </p>