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)
  835  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


Barbara Jones added new Question What is ANR?   3 days ago

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

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

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