<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body>
One of the easiest ways to call a function based on a string is to
index into an array or an object like so:<br>
<br>
<font face="Courier New, Courier, monospace">functionList["myFunction"]();</font><br>
<br>
eval is not inherently bad or inefficient, it is just often used
improperly or in cases where more thought should go into the design and
architecture of the code. It is, in fact, indispensible if you are
trying to extend the core javascript language or work with dynamically
generated/modified code. It should not be used in "every day" code, and
if you find yourself using it in a small bit of code, it is likely you
are misusing it. Nothing is set in stone of course, and this is just a
general guideline.<br>
<br>
<br>
Peter Brunone wrote:
<blockquote cite="mid20040120164912.BCB3E308930@LaTech.edu" type="cite">
  <pre wrap="">   No problem; just start a new thread!

   What if you want to run a function based on a string?

-Peter B.

Original Message:
  </pre>
  <blockquote type="cite">
    <pre wrap="">From: "Chris Tifer" <a class="moz-txt-link-rfc2396E" href="mailto:christ@saeweb.com">&lt;christ@saeweb.com&gt;</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">This is going off-topic, but for some reason I just hate eval(). I don't
believe I've ever found a need to use it.  There's always some other way...

Chris Tifer
    </pre>
  </blockquote>
  <pre wrap=""><!---->

_______________________________________________
Javascript mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</a>
<a class="moz-txt-link-freetext" href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</a>

  </pre>
</blockquote>
</body>
</html>