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


Royce Roy added new Question What is final variable in java?   16 hours ago

Manoj Pandey added new Article Abstraction in Java   yesterday


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