WHAT IS EVAL() IN JAVASCRIPT?

Amit Singh

Total Post:565

Points:2825
Posted by  Amit Singh
 1469  View(s)
Ratings:
Rate this:
  1. Amit Singh

    Post:565

    Points:2825
    What is eval() in JavaScript?

    The eval() method is incredibly powerful allowing us to execute snippets of code during execution in JavaScript.
    Example:
    <script type="text/javascript">
    var USA_Texas_Austin = "521,289";
    document.write("Population is "+eval("USA_"+"Texas_"+"Austin"));
    </script>

    Output:
    Population is 521,289

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!