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)
  845  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 CSS Pseudo-Class   yesterday


Sumit Kesarwani added new Question What is the serialization?   2 days ago

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