Home > DeveloperSection > Interviews > What is eval() in JavaScript?
Amit Singh

Total Post:567

Points:2835

Posted on    March-18-2011 12:00 AM

 JavaScript JavaScript 
Ratings:
 1 Answer(s)
  832  View(s)
Rate this:

Amit Singh

Total Post:567

Points:2835
Posted on    March-18-2011 12:00 AM

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















Recent Activities


Kamlakar Singh added new Blog Convert Text Document to PDF File   11 days ago

Kamlakar Singh added new Article Introduction to Backbone.js   11 days ago

Kamlakar Singh added new Question Explain the AdRotator Control.   11 days ago

Don't want to miss updates? Please click the below button!